Created
February 28, 2022 20:50
-
-
Save WouterNieuwerth/33b49ac17da595cfd12e3260bca6f8fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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