Hello
i am trying to configure facebook dynamic events on my site. I have installed Pageview event that works great on all pages.
Only on product pages i need to insert that code:
<!-- Custom Audience 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','//connect.facebook.net/en_US/fbevents.js');
// Insert Your Custom Audience Pixel ID below.
fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');
fbq('track', 'ViewContent', {
content_name: 'Really Fast Running Shoes',
content_category: 'Apparel & Accessories > Shoes',
content_ids: ['1234'],
content_type: 'product',
value: 0.50,
currency: 'USD'
});
</script>
Content_name, Content_Category, Content_Ids and Value must be variables. I have tried almost anything but it doesnt work. For example i tried:
content_name: '{/literal}{$item.product}{literal}',
content_ids: ['{/literal}{$product_id}{literal}'],
value: '{$item.price}',
<?php echo $product_id; ?>
but nothing worked.
Could you help me?
Thanks in advance