Google Tag Manager

Google Tag Manager allows you to pass data through the GTM data layer.

Google Tag Manager Integration Setup: Shopify Script Tag (i.e. not Shopify Checkout Extensions)

Our Google Tag Manager (GTM) integration can be enabled by toggling our Google Analytics integration to active.

Google Tag Manager Integration Setup: Shopify Checkout Extensions

  1. Create a new Custom Pixel from your Shopify Admin (Go to Settings >> Customer Events)
  2. Click 'Add custom pixel'
  3. Put the following javascript code into the code block
    1. NOTE: Replace 'G-XXXX' with your GTM ID. You can find your GTM ID in GTM under Admin
//Initialize GTM
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXX');

analytics.subscribe("fairing_question_view", event => {
	window.dataLayer.push({
		event: "fairing_question_view",
		order_id: event.orderId,
    question_id: event.questionPrompt,
    question: event.questionId,
	});
});

analytics.subscribe("fairing_question_response", event => {
	window.dataLayer.push({
		event: "fairing_question_response",
		order_id: event.orderId,
    other: event.other,
    question_id: event.questionId,
    question: event.questionPrompt,
    response: event.response,
	});
});

Accept Events from Custom Pixel

  1. Create a trigger for each Fairing event - Fairing Question View and Fairing Question Response
    1. Trigger Type = Custom Event
    2. Event Name = fairing_question_view and fairing_question_response
  1. Create a tag for each event to connect to your GA account

    1. Enter your Measurement ID from the GA account you want to connect to

GTM Data Layer

Once enabled (and if you have GTM properly installed), you'll find the below values being passed through the GTM data layer.

{
  gtm:{start: 12345, uniqueEventId: 4},
  event: "Enquire Survey Response",
  question: "How did you hear about us?",
  response: "Word of mouth",
  availableResponses: [
    "Facebook",
    "Word of mouth",
    "Retail Store",
    "Online Advertisement",
    "Instagram",
    "other"
  ],
  order_id: 987654321,
  other: "false"
}

To utilize these values, you'll need to create custom variables in GTM. Here is a quick video on how to do so: