Top Question Answers about PrestaShop Affiliate Tracking and Pixel in 2017

Posted On: Sep 14, 2018

Categories: Shopping Carts & Platforms

Now the old days are gone when you are the single service provider in the market and customers have no options to go somewhere else. All is over due to advancement in modern technologies and the same happened in ecommerce. Now you can’t run a business at your own but you have to find some new ways of building up your business. One of the successful technique is to make partners or affiliates globally and sell your products in this way. 

Here we are talking about starting affiliate program in PrestaShop that is already used by thousands of stores globally. When we think about PrestaShop, it has option to start affiliate but this is not loaded with plenty of features. So shop owners have to use affiliates modules or services of a company that offers this program on monthly charges.

Here our concern is not to discuss or promote any module but here we are discussing technical problems that are faced by the shop owners while setting up these programs on their store. These problems are discussed with reliable and correct answers so that this guide will be your ultimate guide if you are facing some problem. So let’s start here:

Affiliate Tracking Code

Question No. 1: I want to correctly configure the tracking code for an affiliate network but I don’t know that how to set values for the following variables;


My network provider has following details about these variables

  • Replace ADD_SALE_VALUE with total value of the sale
  • Replace ADD_TRANSACTION_ID with a unique id of the order
  • Replace ADD_DESCRIPTION with a informative description of sale (eg. product_nameXquantity ) (Important: must be URL encoded.)

Here I exactly don’t know that what values to set for transaction ID, sale value and all the other. In what way, I have to call that it will track the sales from affiliates?

Answer: go to the:

paste your code there and:

instead the: __ADD_TRANSACTION_ID__
use: {Tools::getvalue('id_order')}

open the file:

you've got there:


right before this code, paste this one:

          $order =newOrder($this->id_order);

          $cart =newCart($order->id_cart);


          foreach($cart->getProducts() AS $k=>$v){









then in order-confirmation.tpl use:

{$total_to_pay} instead the __ADD_SALE_VALUE__
{$description} instead the __ADD_DESCRIPTION__

save changes and try


Question No. 2: I want to set our two variables product ID and Product price that is without delivery and tax. Affiliate network that I am using has sent me the PIXEL. That code is given below;

what is for id: $id_order
and for price: $order->total_products

I am using PrestaShop 1.3

Answer: open order-confirmation.php page




'HOOK_PAYMENT_RETURN'=>Hook::paymentReturn(intval($id_order), intval($id_module))));


$order =newOrder($idorder);


'order'=> $order,


'HOOK_PAYMENT_RETURN'=>Hook::paymentReturn(intval($id_order), intval($id_module))));


Question No. 3: I am trying to add a tracking code for an affiliate network. I have configured well the C1 and C4 array but unable to understand well the c2 and c3. I need explanation for them.

Here is my PIXEL affiliate code:

Answer: You have to define some extra variables to create comma separated product IDs while using foreach loop. Same will be repeated for quantities and product IDs.

Only one foreach loop will be used  for all this. Then all these variable you have to put into your affiliate pixel code.


'order'=> $order,

try to use

'order'=> $order,

'id_order'=> $id_order,

Affiliate Future Integrating Tracking Code?

Question No. 4:  We have purchased the service of a company affiliate future but now unable to configure correctly the tracking code. Anyone know about (ORDER_REF, ORDER_VALUE)? i.e.: the order value before shipping code, and the order ID code?

We tried to put the tracking code inside order-confiramtion.tpl and changed it with variable like {$totalProducts} and {$id_order} but noting has worked.

Answer: The whole code should be added at bottom of order-confirmation.tpl, with the following order value and ID values to be set:

var orderValue = 'ORDER_VALUE';
var orderRef = 'ORDER_REF';

should be set as follows with each value in inverted commas:

var orderValue = '{$product_total}';
var orderRef = '{$id_order}'; 

Question No. 5: I want to add my partner affiliate code. Where I have to put it to track affiliate sales?

Answer: Add the track code using this module: PrestaShop static blocks. First install this module, go to the footer section from the module configuration via the footer hook, then paste the track code and save changes. Hopefully this will work for you.

Implementation of tracking pixel

Question No. 6: How I can register the affiliate sales using a third party affiliate network. I tried to put the track code in order-confirmation.tpl but don’t know how to use the variables? My code is given below;

Ex.: (in an IMG tag);=[Order_id??]&porductnummer;=[Prod_nr??]&amount;=[ammount??]&totalcost;=[Price_total??]

Answer: You can do it using this free module. When the order will be confirmed, a pixel code will be shown. To use this module, you have to alter the order-confirmation.tpl file and place your img code there.

How do you set up the Affiliate Program?

Question No. 7: I know that there exists an affiliate program in PrestaShop but I don’t know that how to set it. Please help me for correct configuration.

Answer: First you have to install Tracking front office module from PrestaShop backend. After that go to Stats > Referrers, then click "Add new". Give user name and password and input the fee they will receive per click, per order and per percentage. Now the affiliate can track their statistics through going to the url :

Affiliate/ Referrer Not Tracking

Question No. 8: I have created a new affiliate and set the url include = ?referrerID=1. When I tried to test through but it is showing still zero. It means that it is not tracking well. I also tried through referrer =, cleared the cache and index buttons. But it is still out of the way. Need help on this?

Answer: Under technical help, go to technical help - Simple mode section -> HTTP Refferrer -> Include:,. Go to cache and refresh it. So the problem will be solved in this way. Also if you have added '', click add new and input in the INCLUDE field in the HTTP REFERER section, set a affiliate name and click on save. Leave all the other fields as they are already. However, you can set the password field.

Now go to the referrer page in backoffice. Click on month, clear cache and it will start showing the statistics.

Note: These questions are answered by top community developers and do not reflect "FMEModules".