Overview of TradeDoubler Tracking


All the traffic from TradeDoubler is directed to a redirect page, not visible to the public. In this case we call it: tradedoubler_redirect. Depending on the site architecture you need to convert the sample code to the specific site architecture that your site is built on. Code examples are available in several different programming languages. See end of this document.

Important! To be able to set your cookie in IE6 and newer browsers you must have a P3P policy (http://www.w3.org/P3P/).

Pseudo code example

//set session variable with: name = TRADEDOUBLER and value = (the value of the tduid sent from TradeDoubler)
session.set("TRADEDOUBLER") = request.queryString("tduid");

//set persistent cookie with: name = TRADEDOUBLER and value = (the value //of the tduid sent from TradeDoubler)
cookie.set("TRADEDOUBLER") = request.queryString("tduid");

//set cookie expiry to one year from now
cookie.expires = todaysDate+365days;

//redirect functionality. If a parameter with the name "url" was sent in //the request, direct the user to that page. If no "url" parameter was //sent, direct the user to the main page.

url = request.queryString("url");
if (url != empty) {
} else {

2. Checkout page

On the checkout page you should include a question where the user must choose if he or she agrees to participate in a merchant review. Depending on the users choice, a different set of parameters should be added to the image request on the confirmation/receipt page next.

You should also include a link to information about the Merchant review service information page. This url should look like this: http://www.tradedoubler.com/pan/reviewinformation.action?program=&language=&country= Alternative url with organization ID: http://www.tradedoubler.com/pan/reviewinformation.action?organization=&language=&country=

NOTE! Make sure to change < %programId% > , < %organizationId% > , < %countryCode% > and < %languageCode% > to your specific IDs. For country code and language code see appendix 1.

3. Confirmation page

The Image source (track back) should be implemented on the receipt/confirmation page.

Important! The reportInfo value must be sent in URL encoded format. (UTF-8). If it?s not possible to send in UTF-8 format, then the parameter, enc., must be added to the tracking. This parameter will tell in which format the reportInfo is sent. It can be in five different charsets. (enc=0, enc=1, enc=2, enc=3, enc=4) If the enc. parameter is not included then the default value will be, enc=3. (UTF-8). See appendix 2 for more information about different charset.

Pseudo code example

//import the md5 encryption utilities. These utility classes are //provided by TradeDoubler.
//(is already present on your server if using pearl and php) 
import md5;

//get the tduid from the session
tduid = session.get("TRADEDOUBLER");

//get the tduid cookie and override the value from the session if the cookie is found
if (cookie.get("TRADEDOUBLER") != empty) {
tduid = cookie.get("TRADEDOUBLER");

//if no tduid was found, send an empty string
if (tduid == empty) {
  tduid = "";

//set value to organization id provided by TradeDoubler.
organization = "12345";

//set value to secret code provided by TradeDoubler.
secretcode = "4321";

//set value of ordernumber. This value has to be unique for each order.
orderNumber = "abc-12345";

//set value of ordervalue. This value cannot consist of comma (,) or //spaces. Use dot (.) as decimal sign.
orderValue = "114.85";

//set value to event id provided by TradeDoubler.
event = "5678";

//set the value of currency. This is only needed if you intend to report //a different currency than the one that has been
//implemented in your TradeDoubler program.
currency = "GBP";

//create the checksum. It is important that this is done as a string //concatenation. a + b + c = abc (NOT a + b + c = d)
// "v04" stands for the version 4 of checksum
checksum = "v04" + md5(secretcode + "" + ordernumber + "" + ordervalue);

//report info. This information is used to send specific details //regarding the order to TradeDoubler.
//f1 is product number
//f2 is product name
//f3 is product price, use dot (.) as decimal sign
//f4 is product quantity
//use and (&) as separator between the fields.
//if your order consists of many different products you can use pipe (|) //as separator between the products. consists of more than one product 

reportInfo = "f1=XYZ123&f2=nike shoes&f3=74.95&f4=1|f1=XYZ124&f2=adidas hat&f3=19.95&f4=2";

//Important! The reportinfo parameter has to be URL encoded in the UTF-8 format.
reportInfo = URLEncode(reportInfo, "UTF-8");

//review info. This information should be provided if customer is participating in a review
//name is the customers name
//email is the customers email
//expDeliveryDate is the expected delivery date of the purchase //formatted as: yyyy-mm-dd
String review = "name=A Andersson&email=a.andersson@hotmail.com&expDeliveryDate=2005-09-01";

//Example where the customer has accepted to receive a review email and the parameter is posted to this page
String reviewApprove = request.getParameter("reviewApprove");

//The review parameter should be empty if the customer should not get a //review mail
if (reviewApprove == null) {
review = "";

//send the entire report to TradeDoubler by making an image request.
//Important! For sales use: tbs.tradedoubler.com
//For leads use: tbl.tradedoubler.com

< img src="http://tbs.tradedoubler.com/report?organization=< %=organization% >&event=< %=event% >&orderNumber=< %=ordernumber% >&orderValue=< %=ordervalue% >&checksum=< %=checksum% >&tduid=< %=tduid% >&reportInfo=< %=reportInfo% >&review=< %review% >