Jump to content

Facebook Conversion Tracking Install In Prestashop 1.5


Recommended Posts

  • 2 months later...
  • 1 month later...

You can use your themes header.tpl or footer.tpl.

 

In order to get javascript working inside .tpl file, you must put the javascript inside the {literal}{/literal} tags. example :

 

<script language="javascript">

{literal}

function ()

{

Your script

}

{/literal}

 

</script>

  • Like 2
Link to comment
Share on other sites

  • 4 months later...

If you are looking to embed Facebook conversion tracking pixel code on the order confirmation pages (conversion pages) then this module will help you do that.

 

http://addons.prestashop.com/en/analytics-stats-prestashop-modules/8511-facebook-order-conversion-tracking-code-manager.html

 

This module is paid module. You just need to install the module and enter the tracking pixel id. no hassles!

Link to comment
Share on other sites

  • 2 months later...

You can use your themes header.tpl or footer.tpl.

 

In order to get javascript working inside .tpl file, you must put the javascript inside the {literal}{/literal} tags. example :

 

<script language="javascript">

{literal}

function ()

{

Your script

}

{/literal}

 

</script>

 

Can you expand a little more on this? This is what I have, I am unsure if it is correct:

 

<!-- Google Code for Prestahop Sales Conversion Page -->
<script type="text/javascript">
{literal}
/* <![CDATA[ */
var google_conversion_id = 111111111;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "ci3pCOSbgcQvPvl3M";
var google_conversion_value = 0;
var google_remarketing_only = false;
/* ]]> */
{/literal}
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/111111111/?value=0&label=ci3pCOSbgcQvPvl3M&guid=ON&script=0"/>
</div>
</noscript>

 

 

Link to comment
Share on other sites

  • 2 months later...

Unless you have good idea about PrestaShop internals and good programming skills doing it could be difficult. Its not straight forward and things get complicated because implementation might change based on Prestashop version. If you are looking to add FaceBook Ad coversion pixels on your order confirmation page you might try this module 

 

http://addons.prestashop.com/en/analytics-stats-prestashop-modules/8511-facebook-order-conversion-tracking-code-manager.html

 

Hope this helps

Thanks

 

 

 

Has anyone tried this method? 
Work? 
Thank you.

 

Link to comment
Share on other sites

Yes currently compatible with 1.5.6.x versions backed with free support just in case you need help regarding the module. This module has not yet been tested with 1.6 version but we plan to upgrade it soon (hopefully before 1.6 release date).

 

Thanks

Link to comment
Share on other sites

  • 3 weeks later...

Hello everybody!

I have the same problem. Where I must to put the code to work?

I put the code in order-confirmation but don't work? Any ideas?

 

This is the code

 

<!-- Facebook Conversion Code for LineAuto Cumparaturi -->

<script type="text/javascript">

var fb_param = {};

fb_param.pixel_id = '6013327182804';

fb_param.value = '0.01';

fb_param.currency = 'RON';

(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=6013327182804&value=0.01&currency=RON" /></noscript>

Link to comment
Share on other sites

  • 4 months later...

Hi all,

 

just wondering if we can get a definitive answer to this. I am also looking to implement Facebook & Google conversions on my confirmation page, but am a little confused between this topic and the http://www.prestashop.com/forums/topic/250595-solved-affiliate-tracking-code/?hl=tracking topic. The one that is [solved} is for affiliate tracking and I'm wondering if I need to do all of those steps just for Google and Facebook Conversion tracking.

 

Where do I need to insert the scripts? in the order-confirmation.tpl or the confirmation.php file?

 

I am trying to edit the script in my google script so that the values are dynamic. Here's my google script (I inserted the literal tags here as well):

<!-- Google Code for Merch Buys Conversion Page -->
<script type="text/javascript">
{literal}
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "BhF3COLq-lUQsMDN0QM";
var google_conversion_value = 1.00;
var google_remarketing_only = false;
/* ]]> */
{/literal}
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/976445488/?value=1.00&label=BhF3COLq-lUQsMDN0QM&guid=ON&script=0"/>
</div>
</noscript>

Google says I need to edit the (var google_conversion_value = 1.00), here's what they say:

 

If your site has a variable conversion value, determine the PHP expression that displays that value. For example: <?php echo $totalValue ?>, <? echo totalValue ?>

 

I'm trying to do total cart value with tax. what should I edit here?

 

Google also says:

 

You'll also need to add replace the default numeric value with "<%= totalValue%>" in the <noscript> section

 

Would this be it? or would I need to use something other than "<%=totalvalue%>"?

 

 

Thanks for any help, I know there are pay modules, but I know once I get this set myself I won't be changing it, so I hope someone knows how to do this.

Link to comment
Share on other sites

Hi all,

 

just wondering if we can get a definitive answer to this. I am also looking to implement Facebook & Google conversions on my confirmation page, but am a little confused between this topic and the http://www.prestashop.com/forums/topic/250595-solved-affiliate-tracking-code/?hl=tracking topic. The one that is [solved} is for affiliate tracking and I'm wondering if I need to do all of those steps just for Google and Facebook Conversion tracking.

 

Where do I need to insert the scripts? in the order-confirmation.tpl or the confirmation.php file?

 

I am trying to edit the script in my google script so that the values are dynamic. Here's my google script (I inserted the literal tags here as well):

<!-- Google Code for Merch Buys Conversion Page -->
<script type="text/javascript">
{literal}
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxx;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "BhF3COLq-lUQsMDN0QM";
var google_conversion_value = 1.00;
var google_remarketing_only = false;
/* ]]> */
{/literal}
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/976445488/?value=1.00&label=BhF3COLq-lUQsMDN0QM&guid=ON&script=0"/>
</div>
</noscript>

Google says I need to edit the (var google_conversion_value = 1.00), here's what they say:

 

If your site has a variable conversion value, determine the PHP expression that displays that value. For example: <?php echo $totalValue ?>, <? echo totalValue ?>

 

I'm trying to do total cart value with tax. what should I edit here?

 

Google also says:

 

You'll also need to add replace the default numeric value with "<%= totalValue%>" in the <noscript> section

 

Would this be it? or would I need to use something other than "<%=totalvalue%>"?

 

 

Thanks for any help, I know there are pay modules, but I know once I get this set myself I won't be changing it, so I hope someone knows how to do this.

 

To be honest I would purchase this module: http://addons.prestashop.com/en/analytics-stats-prestashop-modules/16809-all-in-one-google-facebook-remarketing-analytics.html

 

I ended up biting the bullet and purchasing it, and I am so glad I did. It is super easy to set up, and the support is awesome. It is definitely worth it in my opinion.

Link to comment
Share on other sites

  • 3 weeks later...

To be honest I would purchase this module: http://addons.prestashop.com/en/analytics-stats-prestashop-modules/16809-all-in-one-google-facebook-remarketing-analytics.html

 

I ended up biting the bullet and purchasing it, and I am so glad I did. It is super easy to set up, and the support is awesome. It is definitely worth it in my opinion.

I ended up making the purchase....alas I guess there is no one willing to help with a free solution, the module is working and the support is great. Thanks. I hope anyone who has this problem in the future and doesn't have the developer knowledge reads this thread.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I ended up making the purchase....alas I guess there is no one willing to help with a free solution, the module is working and the support is great. Thanks. I hope anyone who has this problem in the future and doesn't have the developer knowledge reads this thread.

 

There is a also less expensive module if you are only measuring Facebook ads conversion. Checkout this module

 

http://addons.prestashop.com/en/analytics-stats-prestashop-modules/8511-facebook-ads-order-conversion-tracking-code-manager.html

 

It has excellent rating and great support.

Link to comment
Share on other sites

  • 3 months later...

Hello there,

 

thank you Vekia for finding solutions for every problem and keeping this tpic live, can you help me please? I am stuck with the pixel implementation. I am using 1.5.6.0 with one page checkout. The pixel is created for checkout confirmation, i want to do it like this, the cart price contains the total order price, product + shipping + taxes and I wnat to pay the ad only when the users rich to the checkout page ( I have red all the other threads but couldn't find a solution for this matter...just to implement the default checkout fb pixel, nothing more)

 

1. I have added that code you suggested for the OrderConfirmationController.php file above that specific line

$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
	    ));

2. but the Facebook code seems to be different and I don;t know what to change to it 

 

For testing i have added COD payment method and wire transfer (regularry I dont use this just for tsting now) and for these and any other payment methods I am receving blank page confirmation

 

the facebook code look like this(where the xxxxxxxxxx is the tracking id- i'll replace it with the real one): 

 

I even placed the "Facebook Pixel Helper" an addon for chrome to see if the code is implemented wright

<!-- Facebook Conversion Code for Checkout - MiniMeCraft -->
<script>(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//connect.facebook.net/en_US/fbds.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  }
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'XXXXXXXXXXXXXXXXXX', {'value':'0.00','currency':'RON'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=XXXXXXXXXXXXXXXXXX&cd[value]=0.00&cd[currency]=RON&noscript=1" /></noscript>

I have replaced the value 0.00 with {$total_to_pay} , but in this fb the variables it looks different than previuos verisions, I have tried everything and I an still get blank page and the code is still unverified ( I have tried to verify it by placing many orders after i have implemented the code) please help I don't know what else to try (I don't need an extra module for this)

 

What is wrong or how can I do this to work?Thanks a lot!

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

I just used this feature for Facebook Conversion Tracking and I found the solution.

First I used the solution of Vekia (Thank you again for all the help) to get the product cost here

 

In order to include {$total_products} or {$total_to_pay} inside javascript code, I did not use smarty's {literal}{/literal} tags but {ldelim}{rdelim} instead.

 

So my code for /themes/mytheme/order-confirmation.tpl is at the end:

<!-- Facebook Conversion Code  -->
<script>
(function() {ldelim}
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {ldelim}
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//connect.facebook.net/en_US/fbds.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  {rdelim}
{rdelim})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '111111111111111111', {ldelim}'value':'{$total_products}','currency':'EUR'{rdelim}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=111111111111111111&cd[value]={$total_products}&cd[currency]=EUR&noscript=1" /></noscript>

Hope it helps!

 

 

Hello there,

 

thank you Vekia for finding solutions for every problem and keeping this tpic live, can you help me please? I am stuck with the pixel implementation. I am using 1.5.6.0 with one page checkout. The pixel is created for checkout confirmation, i want to do it like this, the cart price contains the total order price, product + shipping + taxes and I wnat to pay the ad only when the users rich to the checkout page ( I have red all the other threads but couldn't find a solution for this matter...just to implement the default checkout fb pixel, nothing more)

 

1. I have added that code you suggested for the OrderConfirmationController.php file above that specific line

$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
	    ));

2. but the Facebook code seems to be different and I don;t know what to change to it 

 

For testing i have added COD payment method and wire transfer (regularry I dont use this just for tsting now) and for these and any other payment methods I am receving blank page confirmation

 

the facebook code look like this(where the xxxxxxxxxx is the tracking id- i'll replace it with the real one): 

 

I even placed the "Facebook Pixel Helper" an addon for chrome to see if the code is implemented wright

<!-- Facebook Conversion Code for Checkout - MiniMeCraft -->
<script>(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//connect.facebook.net/en_US/fbds.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  }
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'XXXXXXXXXXXXXXXXXX', {'value':'0.00','currency':'RON'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=XXXXXXXXXXXXXXXXXX&cd[value]=0.00&cd[currency]=RON&noscript=1" /></noscript>

I have replaced the value 0.00 with {$total_to_pay} , but in this fb the variables it looks different than previuos verisions, I have tried everything and I an still get blank page and the code is still unverified ( I have tried to verify it by placing many orders after i have implemented the code) please help I don't know what else to try (I don't need an extra module for this)

 

What is wrong or how can I do this to work?Thanks a lot!

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

  • 7 months later...

HELLO THERE ! 

 

I am using one Facebook pixel for whole shop.

 

I used HTML in footer module ( I had it in my presta for free ). I only added code from Facebook to this module without any edit. And it is working ! So simply.

 

I hope it is helpfull. Have a nice day.

Link to comment
Share on other sites

×
×
  • Create New...