TUNE Javascript Tracking is a privacy-compliant tracking method with the accuracy of server-side postbacks but the setup effort of client-side pixel tracking. This tutorial will walk you through the steps of setting up your Offer, adding the Javascript snippets to your page to store sessions, and then post a conversion.
Configure the Offer
- Set the offer's tracking protocol to Server Postback w/Transaction ID
- Add transaction_id={transaction_id} to the Default Offer URL.
For example, if you're directing traffic to:
https://advertisersite.com/storefront
You'll want to ensure the transaction_id is being appended like so:
https://advertisersite.com/storefront?transaction_id={transaction_id}
Add the Javascript Code
1. Paste the code below to the head of any site to add the tracking functionality:
<script>
!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("YOUR TRACKING SERVER DOMAIN")
tdl.identify()
</script>
You'll need to replace "YOUR TRACKING SERVER DOMAIN" with your tracking domain which can be found in your TUNE account under Offers > Manage Offers by selecting an offer in the Generate Tracking panel. Unless you have set a custom tracking domain, it will look something this:
https://demo.go2cloud.org
The above code will load additional methods asynchronously as to not affect your page's load time.
2. Paste the code below to the page where you want to track a conversion:
<script>
!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("YOUR TRACKING SERVER DOMAIN")
tdl.convert()
</script>
Remember to replace "YOUR TRACKING SERVER DOMAIN".
The convert function is fully capable of handling goals and conversion parameters. For more information on the Javascript functions, please refer to the Advanced Integration section in this article