Home > Technique > Affiliate Link Cookies

Affiliate Link Cookies

April 17th, 2010 Leave a comment Go to comments

I was excited to try out a new affiliate link cloaking script that promised to avoid the problem of Internet Explorer stripping out your affiliate link cookies.

You can download Josh Spaulding’s new Clever Cloaker here for free.

The privacy settings in Internet Explorer are more restrictive than say FireFox, so depending on the browser settings, your affiliate cookie may not be accepted by the browser.

The cookie is a piece of text data that is stored on the visitor’s computer for a period of time such as temporarily while they visit a web site, or more permanently such as for hours or even months/years. It identifies the visitor to varying degrees of personal invasion, the very least being a tag that they visited the website before or they were referred by you as an affiliate.

So because this information is related to personal privacy, Internet Explorer has various levels of Privacy Settings in the Internet Options area.

To detect what level of personal information is collected by a website, it looks for a Compact Privacy Policy. If none is found, then there is more chance that a cookie will be rejected.

The Clever Cloaker is unique as far as I can tell, in that it tries to deliver a Compact Privacy Policy to the web browser at the time of redirecting the click to the merchant page. It also has an option to insert GOOGLE Analytics code to accurately track the clicks.

However, when I first tried the script, it didn’t work for me. But I found a fix. In the template.php file, there is some code to replace the header code of the destination site.

Original code:

$page = preg_replace(‘#\<head(.|\s)*?>#i’, $head, $page);

$page = substr($page, 0, stripos($page, "</body"));
 

My version:

$page = $head . substr($page, strpos(strtolower($page), ‘</head>’));

$page = substr($page, 0, strpos(strtolower($page), ‘</body’));
 

So if the redirect doesn’t work for you, you may want to try my mod.

Once I had the script working, I set up a test page that delivered a cookie to try this out.

Visiting the web page directly, I had no trouble with FireFox accepting the cookie, but sure enough, IE 7.0 did block the cookie, but only on the “High” Privacy Setting that blocks cookies from all websites that don’t have a compact privacy setting.

So next I set up a link from Clever Cloaker and got the same result. So it’s compact privacy policy injection didn’t seem to be recognized.

Next I added a compact privacy policy to my test page and when I browsed this directly with my affiliate link, the compact privacy policy was recognized and the cookie was accepted on the High Privacy Setting of IE 7.

Here is some code for a test page that you can try yourself:

<?php
// Look for an affiliate ID
$affid = (int) $_GET[‘affid’];

if ($affid > 1000) {
        // Output a compact Privacy Policy
        header(‘P3P: CP="DSP NON ADM PUBi BUS NAV COM CNT INT ONL PHY DEM"’);
}

if ($affid > 0) {
        // Set a cookie
        setcookie("TestCookie", $affid, time()+3600);  /* expire in 1 hour */
        $notice = "<p>Your affiliate ID is: <b>$affid</b> Check if this is stored in the browser cookie called <b>TestCookie</b></p>\n";
}
?>
<html>
<head>
<title>Affiliate Cookie Tracking Test</title>
</head>
<body>
<h2>Affiliate Cookie Tracking Test</h2>
<p>Hi, if you link to this page with a URL of http://freeprivacypolicy.org/affiliate-cookie-tracking-test/?affid=nnn where nnn is a number. The page will attempt to set a cookie on your browser.</p>
<p>If the number is 1 to 1000 then a Compact Privacy Policy <u>will not</u> be delivered.</p>
<p>If the number is greater than 1000 then a Compact Privacy Policy will be delivered.</p>

<?= $notice ?>

</body>
</html>
 

Or visit these links in turn to observe the effect on your Cookie (which is set to expire in 1 hour):

Basic page: http://www.freeprivacypolicy.org/affiliate-cookie-tracking-test.php

Page with Cookie: http://www.freeprivacypolicy.org/affiliate-cookie-tracking-test.php?affid=123

Page with Compact Privacy Policy and Cookie: http://www.freeprivacypolicy.org/affiliate-cookie-tracking-test.php?affid=1024

In IE you should see an eye with a red stop-sign at the base of the browser window where the Cookie has been blocked.

In FireFox, the Web Developer extension is useful for experiments like this where you can easily view, and delete Cookies.

In Internet Explorer go to Tools -> Internet Options and the Privacy Tab.

Share what you discover in the comments. I didn’t try this with the other Browsers such as Opera and Chrome.

Post to Twitter

Categories: Technique Tags:
  1. December 4th, 2010 at 01:36 | #1

    Andrew hello from a chilly snow covered London & probably no different to conditions in Japan.
    I have read & re-read Josh’s instructions for this CC script & just cannot get to grips with it. I’m not computer programmer literate & frustration is settling in! I’ve looked at too much cloaking software & was won over by Josh’s CC software for addressing IE issues & for the fact that it’s ‘free’. Your piece on the performance of CC is very helpful & I wondered if you could add a tutorial (Dummy Guide) for the installation of CC because I’d really like to get a move on in the affiliate world?
    Many thanks,
    Drew

  2. Andrew
    December 4th, 2010 at 02:09 | #2

    Hi Drew,

    what you need to do is review products from Amazon or better, more obscure affiliate offers.

    Just focus on your niche that you are passionate about. That is my best advice.

    Andy

  3. April 8th, 2012 at 00:18 | #3

    That’s some nice help for affiliate marketeers right there! Awesome.

    Also, thanks for showing the fix to go through on the High setting :)

  1. No trackbacks yet.

CommentLuv Enabled