View
 

Detecting if Users have Affiliate Cookies

In some circumstances you need to tweak what consumers see depending on whether they have affiliate cookies set up or not.

 

The code below checks if a cookie exists, and then calls a function dp_cookie_result(). Replace EVENT_NETWORK_URL with an URL like event.graffly.com (event.network_url).

 

Domains that end with 2performant.com, like sandbox.2performant.com, have the event path at URLs like sandbox-event.2performant.com.

 

// Code

<script type='text/javascript' src='http://img.NETWORK_URL/javascripts/postmessage.js'></script>

<script type='text/javascript'>
  dp_network_url = 'EVENT_NETWORK_URL or NETWORK-event.2performant.com';
  dp_campaign_unique = 'campaign unique code, eg. 6a235ea2f';

   // this function receives the result
   function dp_cookie_result(data) {
    alert(data);
  }

  xtd_receive_cookie();
</script>