Home > Software design >  Prestashop 1.6 - Syntax error when adding Facebook Pixel to the HEAD section
Prestashop 1.6 - Syntax error when adding Facebook Pixel to the HEAD section

Time:06-09

PS 1.6.1.10

I have a problem with adding Facebook Pixel Code to my PS head section. Adding pixel causes fatal error. There is some problem with syntax... it looks like that:

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/shop/themes/default-bootstrap/header.tpl" on line 86 "{if(f.fbq)return;n=f.fbq=function(){n.callMethod?" - Unexpected ".", expected one of: "","" , ")" <-- thrown in /shop/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 86

I was trying to turn off HTLM minifer, clear cache etc. nothing helps. I think the code compiler can't understand this new Facebook pixel syntax, or something like that. Any ideas how to fix that?

CodePudding user response:

If you are inserting "pure" HTML / Javascript inside a Prestashop smarty (.TPL) file, you'll need to wrap your code between

{literal} your code here {/literal} 

tags.

Keep in mind that this is not the "Prestashop way" to achieve your task, you should consider build a simple module to insert your code through a front display hook.

  • Related