Page 1 of 1

Problem with Google Analytics

Posted: Wed Dec 18, 2019 3:53 am
by masteragi
Hello

I tried to add Google Analytics code but it has this error

Code: Select all

Syntax error in template "template:appdata;tmp_template" on line 21 "function gtag(){dataLayer.push(arguments);}" - Unexpected ".", expected one of: "}"
No content blocks defined in template
Anyone know how to fix this?

Thanks

Re: Problem with Google Analytics

Posted: Wed Dec 18, 2019 3:57 pm
by DIGI3
In CMS Made Simple, curly braces {} are reserved for Smarty functions. Because your script uses them, you will need to do one of two things to avoid this:

option one:
wrap the script in {literal} script goes here {/literal} tags

option two:
make sure the script has spaces after any opening curly brace, e.g.:

Code: Select all

{ datalayer.push(arguments); }
instead of

Code: Select all

{datalayer.push(arguments);}
and anywhere else in the script they appear.