Jump to content

Facebook Pixel


xasdown

Recommended Posts

Hi there people, i am just starting prestashop and i am currently building a website in prestashop version 1.7 and currently i am trying to install facebook pixel on my website, first question:

1 - Is there any free module to instal in prestashop 1.7 that allows direct implementation on the website, like it's done in woocommerce?

2 - If there is no free module where should i insert the code to track pepople who buy products? (To build a lookalike audience for targeting.)

Thanks in advance and best regards.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

I added facebook pixel stript in themes/mytheme/templates/_partials/javascript.tpl like this and it works:

{foreach $javascript.external as $js}
  <script type="text/javascript" src="{$js.uri}" {$js.attribute}></script>
{/foreach}

{foreach $javascript.inline as $js}
  <script type="text/javascript">
    {$js.content nofilter}
  </script>
{/foreach}

{if isset($vars) && $vars|@count}
  <script type="text/javascript">
    {foreach from=$vars key=var_name item=var_value}
    var {$var_name} = {$var_value|json_encode nofilter};
    {/foreach}
  </script>
{/if}
{literal}
<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', 'mypixelnumber');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id=myidnumber=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
{/literal}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...