Vigraman Padmanaban Vigraman Padmanaban - 1 year ago 132
Smarty Question

How to add facebook pixel and conversion code to shopware 5

I am using Shopware 5.1.2. I am new to this templating system.

I am trying to add FB pixcel code to the header file.
So I created fb.tpl under


I was appending it to modernizr block:

{extends file='parent:frontend/index/fb.tpl'}

{block name="frontend_index_header_javascript_modernizr_lib" append}
<!-- Facebook Pixel Code -->

fbq('init', 'XXXXXXXXXXXXXX');
fbq('track', 'PageView');
<noscript><img height="1" width="1" style="display:none"
<!-- End Facebook Pixel Code -->

I also tried adding the fb.tpl to the specific theme folder.

And cleared cache.
Still the FB code is not visible in the website.

Answer Source

Move your file to Responsive (or your active theme) theme & rename it as header.tpl like:


Modify file content like below:

{extends file='parent:frontend/index/header.tpl'}

{block name="frontend_index_header_javascript_tracking" append}
<!-- Facebook Pixel Code -->

<!-- YOUR Facebook Pixel Code HERE -->

<!-- End Facebook Pixel Code -->

From Backend menu perform:

Configuration > Theme Manager > Select Active Theme > Compile Theme

Reload frontend page. It should work!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download