Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WouterNieuwerth/33b49ac17da595cfd12e3260bca6f8fe to your computer and use it in GitHub Desktop.
Save WouterNieuwerth/33b49ac17da595cfd12e3260bca6f8fe to your computer and use it in GitHub Desktop.
// Send data to Universal Analytics
const getEventData = require('getEventData');
const sendEventToGoogleAnalytics = require('sendEventToGoogleAnalytics');
const client_id = getEventData('client_id');
const events = {
'x-ga-measurement_id': 'UA-XXXXXX-1', // Replace with your own GA UA ID
'v': 1,
't': 'event',
'cid': client_id,
'ec': 'example event category',
'ea': 'example event action',
'el': 'example event label',
'ni': 1
};
sendEventToGoogleAnalytics(events, (response) => {
data.gtmOnFailure();
});
// Call data.gtmOnSuccess when the tag is finished.
data.gtmOnSuccess();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment