Implementing a de-duplication strategy

Attached are local cookie / deduplication code samples for PHP, ASP Classic and ASP .NET in C#.

ASP .NET version  is for C# only – VB.NET code should be easy enough to work out from the C# version.


The first section of code appears on every possible landing page, and must run before any content is sent to the browser (otherwise it may cause an error like “unable to send headers because content has already been sent” or something similar).


The second section must be wrapped around each different tracking code for each network or online advertising channel (Commission Factory, ClixGalore, Google AdWords Conversion Tracking etc).


The code will look for the following query string parameters to find the traffic source: “r”, “ref”, “source”, “utm_source” or “trafficsource”.

 

You will need to make sure that the referrer fills out one of these properly (so for example, you could add “source=commissionfactory” to the program’s extra parameters). You will need to work out what the other networks send through or speak to them about your de-duplication strategy.

The part that needs to change for each one is “commissionfactory”. Example (assuming that Commission Factory is setup to send “commissionfactory”, ClixGalore to send “clixgalore”, and Google to send “adwords”):

<?php if (isset($_COOKIE["trafficsource"]) == false || $_COOKIE["trafficsource"] == "" || strtolower($_COOKIE["trafficsource"]) == "commissionfactory") { ?>

<!-- Commission Factory Tracking Code Goes Here -->

 

<?php } ?>

 

<?php if (isset($_COOKIE["trafficsource"]) == false || $_COOKIE["trafficsource"] == "" || strtolower($_COOKIE["trafficsource"]) == "clixgalore") { ?>

 

<!-- Clix Galore Tracking Code Goes Here -->

 

<?php } ?>

 

<?php if (isset($_COOKIE["trafficsource"]) == false || $_COOKIE["trafficsource"] == "" || strtolower($_COOKIE["trafficsource"]) == "adwords") { ?>

 

<!-- Google AdWords Conversion Tracking Code Goes Here -->

 

<?php } ?>

The merchant will still need to check all referrers for duplicate transactions, because if the cookie is not found (perhaps because the customer cleared their cookies) then all of the different tracking codes will run at the same time.

  Download the De-Duplication Guide

  Download the Code Samples