Our first-party tracking relies on two javascript files that need to be installed on your website. The first script is our 'entrypoint' script and takes care of the placing the first-party cookies. This script needs to be placed on all pages of your website. The second script is our 'checkout' script which will read the first-party cookie and send all transaction data to our tracking server. This script needs to be placed on the order confirmation pages (a.k.a. 'thank you page').

Installing the entrypoint script

The entrypoint script needs to be installed on all pages of your website. It should be placed as high on the page as possible to ensure it loads successfully. We suggest placing it right after the <body> opening tag.

You can grab the scrip below. Make sure to replace YOUR_OFFER_SLUG with the actual value you received from your account manager.

<script type="text/javascript">
window.tmt_offer_sid = 'YOUR_OFFER_SLUG';
(function() {
var timestamp = +new Date;
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = '//cdn.tmtarget.com/tracking/s/entrypoint_v2.min.js?t=' + timestamp;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>

Installation with Google Tag Manager

The installation with Google Tag Manager is very straightforward:

  1. Create a new tag and choose a descriptive name, for example: "TC Tracking Entrypoint"

  2. In the Tag Configuration choose 'Custom HTML' as the tag type.

  3. Copy paste the entrypoint code from above in the HTML field that appears (make sure you added your offer slug!).

  4. As trigger choose the default 'All Pages' option.

  5. Click save and you're done!

When you're done it should look similar to this:

Installing the checkout script

The checkout script has to be placed on the order confirmation page(s) of your website. It should be placed as high on the confirmation page as possible to ensure it loads successfully. We suggest placing it right after the <body> opening tag.

You can grab the script for the type of transaction you want to track here:

Lead script:

<script>
(function() {
var el = document.createElement('script');
el.setAttribute('src', '//cdn.trackmytarget.com/tracking/s/checkout.min.js');
el.setAttribute('data-type', 'lead');
el.setAttribute('data-offer-sid', '{offer-sid}');
el.setAttribute('data-event-sid', '{event-sid}');
el.setAttribute('data-id', '{id}');
document.body.appendChild(el);
})();
</script>

Sale script:

<script>
(function() {
var el = document.createElement('script');
el.setAttribute('src', '//cdn.trackmytarget.com/tracking/s/checkout.min.js');
el.setAttribute('data-type', 'sale');
el.setAttribute('data-offer-sid', '{offer-sid}');
el.setAttribute('data-event-sid', '{event-sid}');
el.setAttribute('data-id', '{id}');
el.setAttribute('data-amount', '{amount}');
el.setAttribute('data-currency', '{currency}');
el.setAttribute('data-code', '{code}');
document.body.appendChild(el);
})();
</script>

Before placing the script on the confirmation page(s), you should replace all the parameter values in the curly brackets {}.

Parameters

  • {offer_sid} required
    Replace with 6 character sID of the Offer. You can find this value in Offer list of the marketplace or ask your account manager.

  • {event_sid} required
    Replace with the 6 character sID of the product group. You can find this value in the tracking tab when creating or editing an Offer or you can ask your account manager. If you want work with multiple product groups, follow these instructions.

  • {id}
    Replace with the ID you assign to the transactions in your own system. Required if you set up the Offer to require unique transaction IDs

  • {amount}
    Replace with the transaction amount. Do not use any thousand delimiter and use . as decimal delimiter (e.g. 1234.56 ). Required if you want to payout a percentage of the transaction amount to your Publishers.

  • {currency}
    Replace with the three letter alphabetic currency code according to the ISO 4217 standard (e.g. EUR ). Required if you are using the amount parameter.

  • {code}
    Replace with the voucher code used for the order. Accepts all alphanumeric characters, hyphens (-) and underscores (_). Required if you are using voucher code tracking.

Installation with Google Tag Manager

  1. Create the trigger: Start by creating the trigger that fires on your confirmation page, if you already have such a trigger you can skip to step 2.

    Choose DOM Ready as "Trigger type" and for "This trigger fires on" choose Some DOM Ready Events. As firing conditions you need to set Page Path equals and then set the path of the page you created in step 1, for example checkout_success.

  2. Create the tag: Next create a new tag for the checkout script.

    1. Give it a descriptive name. For example "TC Tracking Checkout".

    2. In the Tag Configuration choose 'Custom HTML' as the tag type.

    3. Copy paste the checkout code from above in the HTML field that appears. Make sure that you replace all the parameters. For some parameters, such as data-id, data-amount, data-currency and data-code you need to use Google Tag Manager's Variables.

    4. As trigger choose the trigger you created in step 1 and save the tag.

  3. Publisher changes: Finally, publish the changes you just made to Google Tag Manager.

Did this answer your question?