Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

google-standard-events

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-standard-events

A simple library to type standard Google recommended events

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Google standard events

This is a simple types-only library about the Google-recommended events for ecommerce, as referenced here.

Usage

// With Tag Manager
import type GOOGLE_STANDARDS_EVENTS from "google-standard-events";

export const sendEvent = <E extends GOOGLE_STANDARDS_EVENTS.EVENTS>(
  event: E,
  ecommerce: GOOGLE_STANDARDS_EVENTS.PARAMS<E>
) => {
  return dataLayer.push({
    event,
    ecommerce
  });
};
// With Google tag
import type GOOGLE_STANDARDS_EVENTS from "google-standard-events";

export const sendEvent = <E extends GOOGLE_STANDARDS_EVENTS.EVENTS>(
  event: E,
  params: GOOGLE_STANDARDS_EVENTS.PARAMS<E>
) => {
  return gtag("event", event, params);
};

FAQs

Package last updated on 01 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts