Google tag Manager error – Error parsing XML, line 657, column 43: The reference to entity “l” must end with the ‘;’ delimiter

Here is the solution of Blogger Blogspot Error when we inserting Google tag Manager Code in Blogger Template than error occurred Error parsing XML, line 657, column 43: The reference to entity “l” must end with the ‘;’ delimiter

We solved it…

google tag manager_error in blogger

 

Error parsing XML, line 657, column 43: The reference to entity “l” must end with the ‘;’ delimiter.

<!– Google Tag Manager –>

<noscript>//a%20href=</noscript>

(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=

‘//www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,’script’,’dataLayer’,’GTM-XXXXX’);

<!– End Google Tag Manager –>

Solutions

 

This is a problem with blogger and GTM – blogger parses everything as XML which causes problems with the GTM tag.

Try the following:

In the code of your container tag you should see this line

 

j=d.createElement(s),dl=l!=‘dataLayer’?’&l=’+l:”;j.async=true;j.src=

 

replace that line with this line – the change is highlighted in bold

j=d.createElement(s),dl=l!=‘dataLayer’?’&amp;l=’+l:”;j.async=true;j.src=

Then copy the adjusted code in your blogger template and save the template – it should work now. When you then check the source code of the website you can see that the ‘&amp;’ has been changed back by blogger to the correct ‘&’, so the code that is actually included on the website is exactly the code that GTM requires.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s