Adtraction Tracking Implementation

deltaoptical.pl -- Closed 2024-10-01 - CPS

To track the number of orders / conversions referred by your partners, you need to set up Adtraction tracking on your website. This requires creating a special subdomain under your main domain and linking it to the Adtraction tracking server. When someone clicks on an Adtraction link, they will first pass through this subdomain before being redirected to the appropriate page on your website.

This subdomain is crucial for Adtraction's tracking system because it helps reduce the dependence on third-party cookies. By setting first-party cookies on your domain, it lowers the chance of transactions being missed due to cookie blocking.

Add the Adtraction tracking directly on your website instead of using Google Tag Manager (GTM). This way, it runs faster and more reliably. When tracking goes through GTM, it can sometimes be delayed or blocked by ad blockers, which means some conversions might not be tracked. A direct setup gives you more accurate results, better attribution, and a clearer view of performance.

For any questions about the implementation, feel free to contact our support team.

Step 1 - Create a subdomain

Create a subdomain called pin under your store's existing domain. This will make your subdomain's address look like this: pin.[your_domain], so for example pin.website.com.

Point the subdomain to the Adtraction tracking server by adding a CNAME record with the value cloud.adt790.com. We recommend setting the TTL (Time to Live) to 60 seconds.

You only need one subdomain for each partner program, no matter how many event codes you plan to add.

Once the subdomain is active, inform your contact at Adtraction so we can configure our tracking server to work with your subdomain. As part of this setup, Adtraction will provide an SSL certificate for your subdomain.

Step 2 - Add the Adtraction tag

Add the Adtraction tag to your website and ensure it loads on every page. The easiest way to do this is by placing the tag in your website's global header. Simply copy the entire tag code and paste it at the bottom of the header section, right before the closing </head> tag.

Important: The Adtraction tag is the same for all transaction types in your partner program and only needs to run once per page load. This means that if you're implementing multiple event codes, make sure not to add the Adtraction tag more than once.

<!-- Example -->
<!DOCTYPE html>
<head>
	<script>...</script>
	insert_adtraction_tag_here
</head>

Your Adtraction tag

<script defer src="https://pin.[your_domain]/jsTag?ap=1833983249"></script>

[your_domain] must be replaced with the actual domain where your store is hosted. Important!

Step 3 - Add the event code

To track purchases, you need to add the event code provided below to the purchase confirmation page on your website.

  • [order_value]: Replace this placeholder with the total transaction amount excluding both VAT and delivery costs, after any discounts have been applied. The value must be a decimal number, without any thousand separators and using a standard dot character as the decimal point, for example 1083.29. If your order value is only available with custom formatting, such as thousand separators or commas, a potential workaround is submitting it as a string instead of a number: ADT.Tag.am = "[order_value]".

  • [order_id]: Replace this with a unique booking or order reference. If the same order reference is used more than once, it will be considered a duplicate and won't be tracked.

  • [md5_hash]: Replace this with an MD5 hash of the user's email address. Make sure the email address is trimmed, converted to lowercase, and encoded in UTF-8 before hashing. This hash is used for cross-device tracking. For help with hashing, please refer to our hashing functions.

  • [coupon]: Replace this with the coupon code or voucher code used in the transaction. If no coupon or voucher was used, leave empty.

<script>
	var ADT = ADT || {};
	ADT.Tag = ADT.Tag || {};
	ADT.Tag.t = 3;
	ADT.Tag.c = "PLN";
	ADT.Tag.tp = 1833983350;
	ADT.Tag.am = [order_value];
	ADT.Tag.ti = "[order_id]";
	ADT.Tag.xd = "[md5_hash]";
	ADT.Tag.cpn = "[coupon]";
</script>

This means that both the Adtraction tag and the event code need to be included on the purchase confirmation page. However, if your website is a Single Page Application (SPA), you only need to run the Adtraction tag once when the visitor first arrives on your site. When a purchase happens, populate the event code variables listed above in window.ADT.Tag, and then call the following function:

window.ADT.Tag.doEvent();

Populated example

For a transaction made by user@example.com with an order reference abc123, an order value of PLN 1 138.50 and a coupon code summer, the output on the confirmation page would look like this:

<script>
	var ADT = ADT || {};
	ADT.Tag = ADT.Tag || {};
	ADT.Tag.t = 3;
	ADT.Tag.c = "PLN";
	ADT.Tag.tp = 1833983350;
	ADT.Tag.am = 1138.50;
	ADT.Tag.ti = "abc123";
	ADT.Tag.xd = "b58996c504c5638798eb6b511e6f49af";
	ADT.Tag.cpn = "summer";	
</script>

Implementation checklist

  1. [order_value] should be provided excluding both VAT and delivery costs, after any discounts have been applied.
  2. [order_value] must be provided in the correct currency (PLN).
  3. [order_id] must be unique for each transaction.
  4. [md5_hash] email addresses must be trimmed, converted to lowercase, and encoded in UTF-8 before hashing.
  5. The event code needs to run every time the confirmation page is loaded.
  6. The event code should automatically run once a transaction is completed, without requiring the user to click "return to merchant" or any similar button from an external payment provider.
  7. Tracking must be implemented on both the desktop and mobile versions of the site.
  8. A test purchase should be conducted in the production environment to verify the implementation. Please contact your Adtraction account manager for assistance.