CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Problem with Google Analytics
https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=81811
Page 1 of 1

Author:  masteragi [ Wed Dec 18, 2019 3:53 am ]
Post subject:  Problem with Google Analytics

Hello

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

\$1:
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

Author:  DIGI3 [ Wed Dec 18, 2019 3:57 pm ]
Post subject:  Re: Problem with Google Analytics

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.:
\$1:
{ datalayer.push(arguments); }

instead of
\$1:
{datalayer.push(arguments);}

and anywhere else in the script they appear.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/