Deeplinking Double-Cookie Trick

About a month ago an offer that I was promoting really dropped off. The merchant insisted nothing was wrong, but I didn’t believe them, for very good reason. While this merchant and I have a great relationship, I had customers clicking through with very high intent-to-purchase keywords, and not converting. Luckily, this particular merchant was on two different networks, so I was able to deep-link to get 2 cookies set.

Let’s take 1&1 Internet as an example – on both CJ & Pepperjam. The basic CJ link is, and the basic Pepperjam link is

So on the CJ link, I set the Destination URL to be the Pepperjam link, and come up with

2 CookiesNow in theory, only the last cookie is used for a sale, and you won’t have any trouble with this. If one of the tracking methods fail, then the other should pick up the sale. However, in my case, BOTH cookies often fire, so every day I email the merchant the duplicate orders to reverse.

This month alone, 13.86% of my revenue for this one merchant came from the “backup” tracking system.

Originally I set this up as a test, but I’ve kept it in place to capture those would-be-lost sales. If you wanted to go nuts, you could set three cookies, but the time to go from click to landing page could be long.

How To & Tips


iFrame a Link & Still Track Conversions

@IamJustinM asked the other day

Is it even possible to track visitors and conversions when you have the landing page in an iframe??? Can’t figure it out….

I gave a quick answer, “at top of iframe page, write tracking data to db, then get unique id and use that as your sid w/ the network” but wanted to show it a bit more in detail. So I took 5 minutes I whipped up this quick script:

    mysql_connect('server', 'username', 'password');
    $cTable = 'iframetrack';
    CREATE TABLE `iframetrack` (
        `cSource` VARCHAR( 20 ) NOT NULL ,
        `cKeyword` VARCHAR( 200 ) NOT NULL ,
        `cBrowser` VARCHAR( 200 ) NOT NULL ,
        `nIP` VARCHAR( 16 ) NOT NULL ,
        `tsDatetime` DATETIME NOT NULL
    if (empty($_GET['q'])) {
        list(, $cRefererQS) = explode('?', $_SERVER['HTTP_REFERER'], 2);
        parse_str($cRefererQS, $_RefererGET);
        $_GET['q'] = $_RefererGET['q'];
    } // ends if (empty($_GET['q']))
    $cQuery = "insert into $cTable (cSource, cKeyword, cBrowser, nIP, tsDatetime) values ('" . mysql_real_escape_string(stripslashes($_GET['cSource'])) . "', '" . mysql_real_escape_string(stripslashes($_GET['q'])) . "', '" . mysql_real_escape_string(stripslashes($_SERVER['HTTP_USER_AGENT'])) . "', '" . mysql_real_escape_string(stripslashes($_SERVER['REMOTE_ADDR'])) . "', now())";
    $nID = mysql_insert_id();
    $cAffLink = '' . $nID . '&p=0';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="UTF-8" />
<body style="padding:0px; margin:0px;">
    <iframe name="mainsp" id="mainsp" src="<?= $cAffLink ?>" width="100%" height="100%" scrolling="auto" frameborder="0">
          <p><a href="<?= $cAffLink ?>">Click to continue.</a></p>

Now it’s probably not perfect, but it gives you a way to track this info. When you link to this iframe, set cSource to the source of the visitor (can be just the source, or source & ad number combined – whatever) and (optionally) set “q” to the keyword. If you omit this, it’ll look at “q” from the HTTP_REFERER, which is what most search engines use for the keyword field.

I’m not going to go into detail on how to change things – if you need help, just ask.

How To & Tips