This small tutorial explains how to save Addiliate ‘clickid’ parameter value and send it back using PHP if you don`t have a global variable/functionality on your site that can do this.

The Addiliate S2S pixel code looks like this: http://www.addiliate.com/report.html?clickid=[]&rid=[]&orderid=[]&amount=[]

As you can see we have a couple of parameters for which advertisers can send us information. The clickid parameter is a mandatory one so advertisers need to send all the time value to this parameter. Rest of the parameters are optional.

Below we will focus on how to send the correct value to clickid. When clients are redirected to advertiser landing URL we always append to advertiser landing page URL the clickid parameter with its value that needs to be send back to us when a conversion is made.

Let’s say that this is the advertiser landing page URL: http://www.mysite.com/landing-page-example.html

When a user will be redirected to that page our parameter will be appended: http://www.mysite.com/landing-page-example.html?clickid=wZfuW0N8wDAVmaUMY1OHvJimYH9y2WRu5B2X3iGy

In order to save that value you need to add the following code on your landing page:


<?php

$_SESSION[‘addiliate_click_id’] = $_GET[‘click_id’];

?>

The next step is to integrate Addiliate pixel code and send the correct value for click_id. There are two ways to trigger the Addiliate S2S pixel code: one is doing a postback request to our pixel and the other is to integrate our pixel as an image to the confirmation page. In this tutorial we will cover only the case of integrating the pixel as an image.

On the confirmation page you need to add this code:


<img src=” http://www.mysite.com/landing-page-example.html? click_id=<?php echo $_SESSION['addiliate_click_id']; ?>” width=”1” height=”1” />

Note: In this tutorial we stored clickid`s value in the session, we assumed that you already have a session started, and will be lost after the user terminates the session. If you want to have the value saved for a longer period of time (days) then you need to save the click_id`s value using cookies.