Tutorial: affiliates

affiliates

Affiliate

Introduction

Affiliates are third-party companies that promote your products and services on their websites. They are paid a commission for each sale or lead that they generate.

Usually, affiliates use tracking links to track the traffic they send to your website. When a user clicks on an affiliate link, a cookie is set in the user's browser. This cookie contains the affiliate's ID, which is used to track the user's activity on your website.

Usually, the cookie name is banner_domainclick. The cookie value is a string that contains the affiliate's ID and other information.

In case banner_domainclick cookie is configured in CMS -> Settings -> Cookies section, then it will not be available on the first visit of the player until they will accept the corresponding cookie category.

Therefore, in this case to re-enable affiliate tracking after player has accepted the cookie category, you need to set the affiliate cookie manually via the following snippet:


Playtech.on('cookie-settings-updated', ({ name, value }) => {
   if (name === 'marketing' && value) {
      Playtech.API.affiliate.setAffiliateCookie(Object.fromEntries(new URLSearchParams(location.search)));
   }
});

How to add the snippet

  1. Add the above code to your portal in CMS -> Tag manager -> Tags -> Add Tag -> Custom JS (use "On App Init").
  2. Save, mark tag as active and ready for publishing.
  3. Publish the change to CDN.