data-layer-events
v0.0.2
Published
Push clean events onto Google Tag Manager's dataLayer
Downloads
8
Readme
data-layer-events
This package pushes Google Analytics type events onto Google Tag Manager's dataLayer variable. It cleans up after each push by null
-ing keys that aren't used and supports nonInteraction
events.
Setup
Setup Google Tag Manager Variables for:
genericCategory
genericAction
genericLabel
genericValue
genericNonInteraction
For example:
Then create a Trigger for genericEvent
. Like this:
Finally create Tag that combines all of these. Like this:
Usage
dataLayer = require('data-layer-events');
// Fire a normal, interaction event
dataLayer.event('Category', 'Action', 'Label', 'Value');
// Fire a non-interaction event
dataLayer.nonInteractionEvent('Category', 'Action', 'Label', 'Value');