JavaScript Conversion Tracking for Magento

1. Please add this script to your HOMEPAGE FOOTER and any other entry page (ex: product pages, alternative landing pages).

    • If you’re using Google Tag Manager, you can have this script appear on all source codes pages.
   (function () {
    var clickRe = /(?:=(24.\d+.\d+FOF\d+|\d+FOF\d+|24.\d\w+\.\d\w+\.\d+))/i;
    var match = clickRe.exec(window.location.href);
    if (match && match.length > 0)
        window.localStorage.setItem('sid', match[1]);

2. Please add this script to your ORDER CONFIRMATION PAGE

  • Add account unique ID in the AID parameter found inside your account.
    • Please email your account manager to request it if needed.
  • Add Sale Amount code in the AMT parameter (only required for CPS programs)
    • Shopify parameters provided below has worked with previous accounts before, however, we cannot guarantee that these are still current. If tracking fails, we encourage you to contact Shopify directly to make sure you have the correct parameter.
  • Add Order ID code in the UID parameter (required for all programs)
(function () {
var sid = window.localStorage.getItem('sid');
var req = new XMLHttpRequest();'GET',
    '<?phpecho $order->getGrandTotal(); ?>&ordernumber=<?php echo $lastOrderId; ?>&coupon=&clickid=' + sid );
3. Once implemented, log into your AdvertiserPro account and go to the Settings > Tracking Diagnosis page to complete a test transaction.

Articles in this section