This integration in only available on the Pro plan.
Please note that this is an advanced integration which assumes you're already familiar with Google Tag Manager and that you have a Google Tag Manager account already connected to your Shopify store.
Setup in Shopify
Create a new custom pixel in your Shopify dashboard by navigating to Settings > Customer Events > Custom pixels > Add custom pixel
Choose a name for the pixel - e.g. "Google Tag Manager"
Copy-paste the code below into the Code section. Replace
GTM-XXXXXXXXwith the ID of your GTM pixel, then click Connect.
(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-XXXXXXXX');
analytics.subscribe("pathlight_question_viewed", event => {
window.dataLayer.push({
event: "pathlight_question_viewed",
order_id: event.customData.orderId,
customer_id: event.customData.customerId,
question_id: event.customData.questionId,
question_type: event.customData.questionType,
question: event.customData.question,
survey_id: event.customData.surveyId,
language: event.customData.language,
is_editor: event.customData.isEditor,
});
});
analytics.subscribe("pathlight_question_answered", event => {
window.dataLayer.push({
event: "pathlight_question_answered",
order_id: event.customData.orderId,
customer_id: event.customData.customerId,
question_id: event.customData.questionId,
question_type: event.customData.questionType,
question: event.customData.question,
answer_id: event.customData.answerId,
answer: event.customData.answer,
other_option_value: event.customData.otherOptionValue,
consent: event.customData.consent,
survey_id: event.customData.surveyId,
language: event.customData.language,
is_editor: event.customData.isEditor,
});
});
Setup in Google Tag Manager
In Tag Manager, navigate to Triggers and click on New to create a trigger for each custom event from Pathlight.
As the trigger type, scroll all the way to the bottom and select Custom Event from the Other category.
For the event name enter
pathlight_question_viewed(it's important you use this exact spelling, with no changes or extra spaces). Under "Trigger fires on" select Some Custom Events, then choose{{Event}}equalspathlight_question_viewedRepeat for
pathlight_question_answered
Connect to Google Analytics
From Tags create a new tag and select Google Analytics > Google Analytics: GA4 Event
Copy-paste your measurement ID from Google Analytics and add
pathlight_question_viewedas the Event NameSelect
Pathlight Question Viewedas the triggerRepeat the same configuration for
pathlight_question_answered










