Last active
September 29, 2025 19:50
-
-
Save opsb/47b61e6e6ceecceeefe76f126f996813 to your computer and use it in GitHub Desktop.
Shopify setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://support.tune.com/hc/en-us/articles/1500008231942-Integrating-with-Shopify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.tune.com/staging/tune.js"; | |
| var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t),o.domain=e}} | |
| tdl.init("https://tracking.xpaffilate.com"); | |
| tdl.identify(); | |
| })(); | |
| }); | |
| 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://tracking.xpaffilate.com"); | |
| } | |
| tdl.convert({ | |
| amount: event.data.checkout.subtotalPrice?.amount, | |
| adv_sub: event.name, | |
| adv_unique1: event.data.checkout.order?.id, | |
| }); | |
| })(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment