0.0.6 • Published 5 years ago

react-gtm-track v0.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

React GTM track

This is a react component to help ease the process of sending events and variables to Google Tag Manager via datalayer.

NOTE: You need to add global datalayer variable and GTM container before using this. This component does not add any script on its own. Refer google's official documentation to know how to do that.

Installation

You can install using npm:

npm i react-gtm-track

Usage

  • Enclose the page inside GtmTrackEvents component to keep track of events on it.
  • Pass a unique identifier, gtmCommonFields (optional initial object with common values for all events on the page).
  • It will send pageview event when the page loads by default.
  • To track clicks within this, put an attribute gtmtrack and send custom data specific to that click by data-gtmdata(== stringified customFields Object). The component will take care of combining this data with the common fields.
  • To track form submit, put an attribute gtmtracksubmit
0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago