I pasted this into the head of a master page:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js ... efore(j,f);
})(window,document,'script','dataLayer','GTM-xxxxxxx');</script>
<!-- End Google Tag Manager -->
Flare says there's an unexpected = token (red =), that it was expecting a semicolon. So I add the semicolon and another error is displayed. I can't debug script, so I was wondering if anyone else knows how to deal with this.
Thanks!
Google Tag Manager code contains "unexpected token"
-
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: Google Tag Manager code contains "unexpected token"
Where did you put the semicolon? Just because one is claimed to be missing does not mean it needs to go right after the equal sign.
Where does that script come from? Did it ever work before?
Edit: Nevermind...I saw where you got that code from. When I try validating it in various tools they all flag an error.
I suggest you ask on forums that are targeted to Google Tag Manager. It does not seem to be an issue caused by Flare.
Seems to be a common issue based on this search
https://duckduckgo.com/?q=google+tag+ma ... moon&ia=qa
Where does that script come from? Did it ever work before?
Edit: Nevermind...I saw where you got that code from. When I try validating it in various tools they all flag an error.
I suggest you ask on forums that are targeted to Google Tag Manager. It does not seem to be an issue caused by Flare.
Seems to be a common issue based on this search
https://duckduckgo.com/?q=google+tag+ma ... moon&ia=qa
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Re: Google Tag Manager code contains "unexpected token"
After much research, I found an answer that worked for me in the MadCap forums. There is an ampersand & character in the Google Tags script that the XML parser in Flare does not like. You have to escape it out. Refer to this entry on the forum.
viewtopic.php?f=13&t=30902&p=134073&hil ... en#p134073
Replace the & with &
viewtopic.php?f=13&t=30902&p=134073&hil ... en#p134073
Replace the & with &