Jump to content

[solved] Tracking pixel implementation


Recommended Posts

Hello,

I'm trying to implement a tracking pixel from an affiliate marketing network in my shop which runs Prestashop 1.5.

They've asked me to insert the following code on order-confirmation.tpl page:

<img src="http://www.affiliatenetwork.com/tracking/3/237/ANY_UNIQUE_COMBINATION_THAT_IDENTIFIES_AN_ORDER/ORDER_AMOUNT/CART_SUMMARY" width="1" height="1">

When i used PS 1.4 i've replaced "any unique combination that identifies an order" with {$id_order} and "order amount" with {$orderTotal} and it worked fine so I've inserted the code in the seme form:

<img

src="http://www.affiliatenetwork.com/tracking/3/237/{$id_order}/{$orderTotal}/"

width="1" height="1">

 

After a test order was made, they've told me that the code isn't installed correctly and they can't see the order total in their system, probably because on order-confirmation.tpl page isn't shown the amount of the order so they asked me to insert the following code to /override/controllers/OrderConfirmationController.php:

<?php

class OrderConfirmationController extends OrderConfirmationControllerCore

{

public function displayContent()

{

global $cart;

 

self::$smarty->assign('orderTotal', ($cart->getOrderTotal() / 1.24) - $cart->getOrderShippingCost());

 

parent::displayContent();

}

}

This code is made for PS 1.4 and i don't know to much about programming so please tell me how should the tracking pixel look like and what code should i insert, and where, on orderconfirmationcontroler.php to make it work.

 

Thank you

Edited by vekia (see edit history)
Link to comment
Share on other sites

I've put this code on orderconfirmationcontroller.tpl:

	    $order = new Order($this->id_order);
	    $cart = new Cart($order->id_cart);
	    $description="";
	    foreach ($cart->getProducts() AS $k=>$v){
			    $description.=$v['name']."X".$v['quantity'];
	    }	 
	    $description=urlencode($description);

	    $this->context->smarty->assign(array(
	    'total_products'=>$order->total_products_wt,
	    'description'=>$description
	    ));

and inserted this tracking code on order-confirmation.tpl

<iframe frameborder="0" width="1" height="1" src="http://www.affiliatenetwork.com/tracking/2/237/{Tools::getvalue('id_order')}/{$total_to_pay}/{$description}"></iframe>

They've tested it and said the lead is being registered but no commision is generated because on the page source isn't any price representing the total amount of the order.

 

Can you please verify if i've made the correct settings?

Link to comment
Share on other sites

you're talking about {$total_to_pay} variable?

 

you want to use:

- total products value without tax ?

- total products value with tax ?

- total products value without tax + delivery ?

- total products value with tax + delivery ?

Link to comment
Share on other sites

Hello,

The tracking code is installed correctly now but they asked to show price without tax. what should i write instead of {$total_products}?

Also, should i change the code implemented on orderconfirmationcontroller.tpl? Right now it's

'total_products'=>$order->total_products_wt,

Thanks

Link to comment
Share on other sites

so if you have to use product total value but without tax - use {$total_products} variable

 

it's defined in the php code:

$this->context->smarty->assign(array(
			   'total_products'=>$order->total_products,
				'description'=>$description
				));

Link to comment
Share on other sites

I've looked on the other topic which you recomended and saw this

so use the:

'total_products'=>$order->total_products,

 

or with tax included:

'total_products'=>$order->total_products_wt,

 

If i want the tracking pixel to register prices without tax i should use the first variable?

Link to comment
Share on other sites

  • 1 year later...

Hello everybody!

 

I have the same problem, I am using prestashop 1.6, can you help me please? I have no idea where to put the conversion pixel tracking code from facebook, I want to track my ads. Can you write me the path in prestashop? I know there is a modul to buy for that but I also gained the information you can put it manualy, I am believing it is not that hard. I appreciate your help! I am just a beginner. Thanx a lot!

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...