How to Add Google Tag Manager to Blogger without Errors

Google Tag Manager is a tag management system (TMS) that enables rapid and simple updating of measurement codes and associated code fragments, also referred to as tags, on your website or mobile application.

Add Google Tag Manager to your blogger blog

Click the Theme/Template menu item in the main navigation of your blog settings, then select Edit HTML from the screen that appears, to edit the HTML template of your Blogger site.

Copy the GTM script code from your Google Tag Manager account:

How to Add Google Tag Manager to Blogger without Errors

After adding above code snippet to your blogger then press save icon from top right corner. 

Now, you will see this error (ref. screenshot) 

The reference to entity "l" must end with the ';' delimiter.
How to Add Google Tag Manager to Blogger without Errors

Here is how to fix this error:

In the GTM code snippet, find the following code: 

dl=l!='dataLayer'?'&l='+l:'';

and change the ampersand (&) to its HTML encoded counterpart (&), so that the code looks like this: 

dl=l!='dataLayer'?'&l='+l:'';

That's it! You will see no errors after clicking save icon. GTM is linked with your blogger site now.

The Blogger template format has a strict encoding schema, and unusual characters like ampersand that are not escaped or encoded will result in errors in the template if they are left unfixed.

Post a Comment

If you have any questions or concerns, please let me know.

Previous Post Next Post