Integration Overview
This document provides an overview of how to integrate Shopify events with TUNE, allowing you to track the success of your marketing campaigns by monitoring click events, direct links, and conversion goals. The integration uses custom events that subscribe to various Shopify events (e.g., page views, purchases) and send tracking data to TUNE for accurate reporting and optimization.
Use Case Examples
Integration Instructions
The integration involves subscribing to Shopify events, such as page views, clicks, and purchase events, and then using a custom JavaScript function to send data to TUNE. These events are mapped to distinct actions within TUNE: click, conversion, and identify.
- Click Event (Tracking Clicks): Triggered when users click on a link to track engagement.
- Page View Event (Tracking Direct Links): Triggered when a user views a page via a direct link.
- Conversion Event: Triggered when a user completes a purchase or another goal-defined action.
Creating Events in Shopify
To create an event in Shopify, follow these steps:
- Click on Settings in the Shopify Admin panel (bottom left corner)
- Click on Customer Events in the Settings menu
- Click on Add custom pixel (top right)
- Provide a Pixel Name and click the Add Pixel button
- Navigate to the Code box and paste the Click Event (or Conversion Event) code
- Update the Click Event code with your tracking domain, offer ID, and affiliate ID. If you're using the Conversion Event code, be sure to update your tracking domain and goal ID
- Click Save at the top of the page, then Connect under the code box to deploy the
code to the store
Customer Privacy Settings
TUNE advises that the Customer Privacy options for both Customer Events be set as follows:
- Permission > Required and tick Analytics
- Data Sale > Data collected does not qualify as a data sale - unless you are collecting additional information such as contact details.
Example Event Codes
Click Event
analytics.subscribe("page_viewed", event => {
(function(){var o=window.tdl=window.tdl||
[];if(o.invoked)window.console&&console.error&&console.error("Tune snippet has
been included more than once.");else{o.invoked=!0,o.methods=
["init","identify","convert"],o.factory=function(n){return function(){var
e=Array.prototype.slice.call(arguments);return e.unshift(n),o.push(e),o}};for(var
e=0;e<o.methods.length;e++){var
n=o.methods[e];o[n]=o.factory(n)}o.init=
function(e){var
n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://js.go2sdk.com/v2/tune.js";
var t=document.getElementsByTagName("script")
[0];t.parentNode.insertBefore(n,t),o.domain=e}}
tdl.init("https://NETWORKID.go2cloud.org");
tdl.identify();
})();
});Conversion Event
analytics.subscribe("checkout_completed", event => {
(function () {
if (!window.tdl || !window.tdl.invoked) {
var o =window.tdl =window.tdl || [];
o.invoked = true;
o.methods = ["init", "identify", "convert"];
o.factory =function (method) {
return function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
o.push(args);
};
};
for (var i = 0; i < o.methods.length; i++) {
var method = o.methods[i];
o[method] = o.factory(method);
}
o.init =function (domain) {
var script = document.createElement("script");
script.type = "text/javascript";
script.async = true;
script.src = "https://js.go2sdk.com/v2/tune.js";
var firstScript = document.getElementsByTagName("script")[0];
firstScript.parentNode.insertBefore(script, firstScript);
o.domain = domain;
};
tdl.init("https://NETWORKID.go2cloud.org");
}
tdl.convert();
})();
});Utilizing the TUNE JavaScript SDK to Capture More Shopify Data
You can leverage the [TUNE JavaScript SDK](https://developers.tune.com/javascript-sdk/getting-started-with-the-javascript-sdk/) to enable more advanced use cases.
Domain Support
The JavaScript Tracking only supports same-site and cross-origin conversions at this time. This means that if the domain on the landing page is different from the domain on the checkout page (and it is not a subdomain), the SDK will not be able to track conversions. See below for examples.
Supported
1. Single custom Shopify domain
Landing page: mystorename.com/landing
Checkout page: mystorename.com/checkout
2. Custom domain with sub-domains
Landing page: mystorename.com
Checkout page: checkout.mystorename.com
Not Supported
1. Default free Shopify domain
Landing page: mystorename.myshopify.com
Checkout page: checkout.shopify.com
2. Multiple custom Shopify domains
Landing page: mystorename.com
Checkout page: mycheckoutpage.com