Skip to content

Order Page

trackOrder()

Call on the order confirmation page. Duplicate orders are automatically prevented.

Pay later (total = 0): Omit the payment field.

javascript
(async function () {
  await new Promise(function (resolve) {
    if (window.AffiliateSDK) return resolve();
    var interval = setInterval(function () {
      if (window.AffiliateSDK) {
        clearInterval(interval);
        resolve();
      }
    }, 50);
  });

  await window.AffiliateSDK.trackOrder({
    orderId: "ORD-12345",
    customer: {
      email: "customer@example.com",
    },
    total: 0,
  });
})();

Full or partial payment: Pass payment: "complete".

javascript
(async function () {
  await new Promise(function (resolve) {
    if (window.AffiliateSDK) return resolve();
    var interval = setInterval(function () {
      if (window.AffiliateSDK) {
        clearInterval(interval);
        resolve();
      }
    }, 50);
  });

  await window.AffiliateSDK.trackOrder({
    orderId: "ORD-12345",
    customer: {
      email: "customer@example.com",
    },
    total: 99.99,
    subtotal: 89.99,
    tax: 8.0,
    payment: "complete",
  });
})();

trackThankYouPageViewed()

Call after trackOrder() on the order confirmation page.

javascript
(async function () {
  await new Promise(function (resolve) {
    if (window.AffiliateSDK) return resolve();
    var interval = setInterval(function () {
      if (window.AffiliateSDK) {
        clearInterval(interval);
        resolve();
      }
    }, 50);
  });

  await window.AffiliateSDK.trackThankYouPageViewed({
    orderId: "ORD-12345",
    customer: {
      email: "customer@example.com",
    },
  });
})();

destroy()

javascript
(async function () {
  await new Promise(function (resolve) {
    if (window.AffiliateSDK) return resolve();
    var interval = setInterval(function () {
      if (window.AffiliateSDK) {
        clearInterval(interval);
        resolve();
      }
    }, 50);
  });

  await window.AffiliateSDK.destroy();
})();

Released under the MIT License.