Jump to content
  • 0

FB Pixel na PrestaShop


h4zy

Question

Witajcie,

 

chce zainstalować pixel facebooka w sklepie, żeby móc kierować do klientów dynamiczne reklamy produktów. Z FB otrzymuje taki kod:

fbq('track', 'ViewContent', {
  content_type: 'product', 
  content_name: 'Nazwa produktu',
  value: 49.99,
  content_ids: ['123']
});

Nie mogę poradzić sobie ze zmianą wartości w "content_ids", "value" i "content_name" żeby dynamicznie pixel pobierał informacje o produkcie (jego id, nazwę i cenę), który klient właśnie ogląda.

 

Macie pomysł co tam wstawić? :)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Witam,

 

W pliku footer.tpl szablonu przed tagiem zamykającym </body> należy wstawić taki kod:

{if $page_name =='product'}
{literal}
<script type="text/javascript">
fbq('track', 'ViewContent', {
  content_type: 'product', 
  content_name: '{/literal}{$product->name}{literal}',
  value: {/literal}{$product->getPrice(true, $smarty.const.NULL, 2)}{literal},
  content_ids: ['{/literal}{$product->id}{literal}']
});
</script>
{/literal}
{/if}

Modyfikacja tyczy się wersji Prestashop 1.6.

 

  • Like 1
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...