New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gtm-helper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtm-helper

## Config

  • 0.0.6
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

GA Module

Config

  • data-ga-category will be the wrapper that is put around each top level component.
  • data-ga-action is the type of event it is
  • data-ga-label any extra information which could categorise the actions
  • data-ga-scroll-tracking add to the top level component when scroll tracking

these options can be changed to your own config if needed:

import { ConfigChange } from 'gtm-helper';

const config = {
  category: 'data-ga-category-new',
  scroll: 'data-ga-scroll-tracking-new',
  action: 'data-ga-action-new',
  label: 'data-ga-label-new',
};

ConfigChange(cofig);

Data Structure

// On VIEW
dataLayer.push({
  'event': 'promotionView',
    'ecommerce': {
    'promoView': {
      'promotions': [
        {
          'name': data-ga-category,
          'position': data-ga-action,
          'creative': data-ga-label
        }
      ]
    }
  }
});

// On CLICK
dataLayer.push({
  'event': 'promotionClick',
    'ecommerce': {
    'promoClick': {
      'promotions': [
        {
          'name': data-ga-category,
          'position': data-ga-action,
          'creative': data-ga-label
        }
      ]
    }
  }
});

Tracking click events on components

what will it do and how does it do it...

import { TrackClickEvents } from 'gtm-helper';

TrackClickEvents();// uses default config

Tracking if the user has viewed a component

what will it do and how does it do it...

import { TrackComponentsInView } from 'gtm-helper';

TrackComponentsInView();

FAQs

Package last updated on 14 Feb 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc