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/48679d01d8391040c4cfd0768dbed74f to your computer and use it in GitHub Desktop.
Save WouterNieuwerth/48679d01d8391040c4cfd0768dbed74f to your computer and use it in GitHub Desktop.
// Send data to GA4
const getAllEventData = require('getAllEventData');
const sendEventToGoogleAnalytics = require('sendEventToGoogleAnalytics');
const events = getAllEventData();
// Add extra fields to the events object:
events.firstname = 'Wouter';
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