Work in Progress: How to send data to Google Tag

  • Create a new custom Data Output and select Manual Trigger Only

  • For the first Google Tag event that is triggered on the flow, the following code should be added:

function output(userData, context) {
   window.gtag = function(...args) { dataLayer.push(args); }
  return dataLayer.push({ event: 'eventName' }) //replace with the right event name
}
  • For the rest of the Google Tag events on the flow, follow the structure below:

function output(userData, context) {
	//replace eventName with the right event name, add all the properties you need to the same object, an example below
  return dataLayer.push({ event: 'eventName', email: userData.email, questionNumber: `Question 1` })
}
  • Trigger the data outputs on page complete or page load on the pages where they are needed

Last updated