This integration in only available on the Basic and Pro plans.
Please note that this is an advanced integration which assumes you're already familiar with Google Analytics and that you have a Google Analytics 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 Analytics"
Copy-paste the code below into the Code section. Replace
G-XXXXXXXXwith your Measurement ID (on line 5 and line 13), then click Connect. You can find the Measurement ID in Google Analytics, under Property settings > Data collection and modification > Data streams > Measurement ID
(function(){
var f = document.getElementsByTagName('script')[0];
var j = document.createElement('script');
j.async = true;
j.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX';
f.parentNode.insertBefore(j, f);
})();
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-XXXXXXXX');
analytics.subscribe("pathlight_question_viewed", event => {
gtag("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 => {
gtag("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 Custom Dimensions
Without taking any extra steps, the pathlight_question_viewed and pathlight_question_answered events will already show up in the Google Analytics dashboard.
However, if you'd like to explore the event payloads in reports (e.g. to filter, break down and segment based on answers), we recommend setting up custom dimensions for each event parameter:
order_id
customer_id
question_id
question_type
question
answer_id
answer
other_option_value
consent
survey_id
language
is_editor
Navigate to Admin > Custom definitions and click on Create custom dimensions
Under Dimension name add
Pathlight Answer. Under event parameter typeanswer. Optionally add a description, keep the scope asEventand Save.Repeat for all of the parameters you'd like to monitor or use in reporting.
Setup Segments
Navigate to Admin > Segments and click on New Segment
Select User segment
Give the segment a name (e.g. "Instagram Customers") and click on Add new condition
Choose Events >
pathlight_question_answeredClick on Add parameter
Choose Custom >
Pathlight AnswerUnder Condition select
containsand then type the answer you'd like to match to this segment (e.g.Instagram).
You can now use this segment in your reporting and explorations. Repeat for all events, properties and answers you'd like to match.
If you prefer using Google Tag Manager, please check out this article on how to use GTM to connect Google Analytics.
We'd also encourage you to check out the official Google Analytics docs for more details on setting up custom dimensions and segments.












