Google Analytics add

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
2fralph
New Member
New Member
Posts: 1
Joined: Wed Jun 05, 2019 4:15 am

Google Analytics add

Post by 2fralph »

Struggling to add in my Google analytics code at the bottom of </head>

It says this

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

This is the piece of code that google has given me and it doesn't like it?
Anyone have any thoughts?

Cheers
scooper
Forum Members
Forum Members
Posts: 242
Joined: Fri Dec 09, 2005 12:36 pm
Location: Marlow, UK

Re: Google Analytics add

Post by scooper »

CMSMS thinks anything surrounded by braces is a Smarty template tag and will try to process it.

You can either let Smarty know not to try parsing the code by wrapping the javascript in {literal} {/literal} tags, or you can add a space immediately after the opening brace so that Smarty doesn't think it's a tag.

Code: Select all

{literal}
function gtag(){dataLayer.push(arguments);} 
{/literal}
or

Code: Select all

function gtag(){ dataLayer.push(arguments); }
s.
Locked

Return to “Modules/Add-Ons”