Jump to content

Facebook tracking pixel (conversion) - Prestashop 1.4.9


Recommended Posts

Hi, we have e-shop (Prestashop 1.4.9) and we would like to add Facebook code to track conversion.

We've read the discusions here, but we can't still find out, how to make it work. People in discussion solve just a tracking pixel for affilates (is it the same?) and then for Prestashop 1.5. ...

We suppose it's not just about adding the code into order-confirmation.tpl?

 

Thank you for your all advices

Ix

 

The code:

<!-- Facebook Conversion Code for Objednávky -->
<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = 'xxxxxxxx';
fb_param.value = '0.00';
fb_param.currency = 'CZK';
(function(){
  var fpw = document.createElement('script');
  fpw.async = true;
  fpw.src = '//connect.facebook.net/en_US/fp.js';
  var ref = document.getElementsByTagName('script')[0];
  ref.parentNode.insertBefore(fpw, ref);
})();
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=xxxxxxx&value=0&currency=CZK" /></noscript>
Edited by Ixtein (see edit history)
Link to comment
Share on other sites

But please, could you help us which instrucions in that discussion should we follow? Which step shoud we start with?

 

Is the 1st step?:

 

go to the:

themes/your_theme/order-confirmation.tpl
paste your code there and:

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

 

and then:

 

open the file:
controllers/front/OrderConfirmationController.php


you've got there:
$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
right before this code, paste this one:

     $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_to_pay'=>$order->getOrdersTotalPaid(),
     'description'=>$description
    
));
then in order-confirmation.tpl use:

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

 

Is this all? Where should we add the Facebook tracking code?

We are sory we bother you with that, but we aren't native english speakers and not good programmers

Thank you :)

Link to comment
Share on other sites

let's clarify something,

what variables used in facebook converstion tracking mean?

fb_param.pixel_id = '6015760270313';
fb_param.value = '0.00';
fb_param.currency = 'CZK';

fb_param.pixel_id - this is a ID number of pixel, you have to use it? or it's an individual id number of order?

param value - order total (with tax? without tax? with shipping? without shipping?)

currency - it's obious :) so i don't need explanation

 

 

EDIT

i wrote an step by step guide: fb conversion pixel 

 you can read here how to add it with html box pro module, it will replace dynamic variables like value of order or currency

Link to comment
Share on other sites

×
×
  • Create New...