Jump to content

Confusion on Facebook Conversion Tracking Pixel


Guest

Recommended Posts

Hey guys,

 

I've been trying to figure out how to implement FBs Conversion Tracking Pixel into Prestashop. A lot of conflicting information on the forums unfortunately.

 

The code I'm given I understand must go into order-confirmation.tpl, but do I need edit any controllers as well (OrderConfirmationController)?

 

Has there been any tutorials on this for PS 1.5?

 

Would appreciate any guidance! :)

Link to comment
Share on other sites

http://www.prestashop.com/forums/topic/250595-solved-affiliate-tracking-code/

there is detailed step by step guide regarding to this.

 

or this article dedicated especially to conversion tracking pixel:

i wrote guide about 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

Hey vekia,

 

I stumbled across that thread earlier, maybe you can help me out because I still don't understand it. :(

 

So basically I add my pixel to order-confirmation.tpl in my theme dir.

 

<!-- Facebook Conversion Code for Main Site Campaign #1 -->
<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = '6017281491202';
fb_param.value = '0.00';
fb_param.currency = 'USD';
(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=6017281491202&value=0&currency=USD" /></noscript>

 

Then I add to OrderConfirmationController.php:

 

 
$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(),
   'description'=>$description
   ));
 
Do I have that right?
 
Thanks for your help vekia!
Edited by Guest (see edit history)
Link to comment
Share on other sites

Hey vekia,

 

Thanks for the quick response - appreciated as always!

 

Yes, we only use USD currency at the moment. 

 

I can change that in the code, is that all the changes I need to make? With those changes and following the instructions I previously listed I should be good to go?

 

Thanks again vekia!

Link to comment
Share on other sites

×
×
  • Create New...