Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 412 Vote(s) - 3.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a conflict between smarty and google analytics (prestashop 1.4)

#1
I'm trying to add a new google analytics event in a form.
So I have something like this :

<a href="#" name="button1" onclick="dataLayer.push({'event': 'button1-click'});" >Button 1</a>

So far, so good. But I get this weird smarty error :

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "C:\wamp\www\mycookit/themes/cookit/delivery.tpl" on line 164 "dataLayer.push({'event': 'event_name'});" - Unexpected ": ", expected one of: "}" , " "' in C:\wamp\www\mycookit\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 431

Has this ever happened to annyone? Is it prestashop? Is it just me?

I never had any problem doing this on other websites but none of them where on prestashop or smarty.
Reply

#2
just add a space after { and before } in your onclick event so smarty does not get confused
Reply

#3
You can use the {literal}{/literal} tag as well to prevent smarty from compiling this part of code :

{literal}<a href="#" name="button1" onclick="dataLayer.push({'event': 'button1-click'});" >Button 1</a>{/literal}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through