Skip to main content
All CollectionsSales TrackingJavascript Postback Tracking
Aspire Javascript Postback Tracking for Non-Shopify Websites
Aspire Javascript Postback Tracking for Non-Shopify Websites

How to implement Aspire's Javascript Postback Tracking for Non-Shopify websites

Simma Baghbanbashi avatar
Written by Simma Baghbanbashi
Updated over a week ago

The Aspire Javascript Postback tracking provides a cookieless tracking solution for brands running their networks. Sessions and conversions can be generated inside the end user's browser by implementing the tracking scripts on any page of your website.

The Aspire Javascript postback offers client-side functionality for session storage and creator conversions. By utilizing the Javascript postback, you'll have the accuracy of server-side postback with minimal technical setup effort. This article will walk you through adding the Javascript postback tracking scripts to a page to start & store sessions and then post a conversion.

Before you Begin

You'll need to go through a few steps before using the Javascript Postback to interact with an Aspire Sales Tracking Offer.

  1. The Javascript Postback utilizes "server-side" postbacks. For the Javascript Postback to work, you'll need to set the Conversion Tracking method of your link tracking offer in Aspire to "Javascript Postback".

  2. In the Offer URL, you'll need to ensure you're forwarding the transaction_id as a parameter on the 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}

Step 1: Adding the Snippet and identify

Adding the Aspire Javascript Postback is simple. Paste the code below to the head of any site to add the Postback’s 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("https://aspireiq.go2cloud.org")
tdl.identify()
</script>

The identify method is when you want to store or generate a user's session. If you're familiar with our sales links, this method largely corresponds to a "click.” As you see in the above snippet code, the identify method is called like so:

tdl.identify()

That will pull the transaction_id parameter from the URL's query string and store it in the user's browser's local storage.

We recommend using a backend template or theme to help put the call into the footer or header of every page of your site a user might first visit. That way, no matter which page or product the user first lands on, they will always store their session.

Step 2: Convert

The convert method lets you record a conversion using the user's stored session. Since the session's transaction ID has the associated affiliate and offer IDs, you do not need to include these when calling the convert method.

At its most basic, the convert method is:

tdl.convert()

On your conversion page, where it should be placed on thank you page after purchase, the script should look like this:

<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("https://aspireiq.go2cloud.org")
tdl.convert()
</script>

If you want to track the Sales Amount and Commission, it is important to include the conversion link parameters in your scripts.

tdl.convert([conversion_data]);

For Aspire to determine the correct payout for offers using cost-per-sale (CPS) options, you must pass the sale amount in the conversion pixel code or postback URL. We also recommend passing through the Order ID.

If you want this information, append the following parameter to your conversion link:

  • amount

  • adv_unique1

The order ID is usually passed into an adv_unique field. Your engineering or eCommerce team should help you provide the desired information as a value in that parameter.

Below is an example of what this would look like for a Shopify brand. Keep in mind that each eCommerce conversion data is different, so we recommend consulting with your engineering or eCommerce team.

tdl.convert( 
{
'amount':'{{ line_items_subtotal_price | money_without_currency | remove: ',' }}',
'adv_unique1': '{{ checkout.order_number }}',
}
)

Note: Ensure the thank you page that adds the convert function script doesn’t repeat the click (Step 1). Having both on the same page can cause double-counting clicks in your reports.

Frequently Asked Questions

Is this a one-time setup or something we'll need to do for every new Sales Tracking Offer we create?

This only has to be done one time! 👍

Did this answer your question?