This is a very simple tip, but judging by the number of queries on the Product Forums, it should prove helpful.

Blogger is a free blogging service by Google. Like WordPress, they allow you to run hosted blogs on the blogger.com domain, and they also allow you to modify the HTML source. This, of course, means that you can add the Google Tag Manager code to the HTML template, if you wish (and why wouldn’t you!).

There’s just a small catch.

X

The Simmer Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava into your email inbox!

Tip 23: Add GTM Container Snippet to the Blogger blog template

To edit the HTML template of your Blogger blog, click the Template menu item in the main navigation of your blog settings, and then choose Edit HTML in the screen that is displayed.

Next, copy-paste the GTM container snippet into its rightful place just after <body>.

Now, here’s the important thing. In the container snippet, find the following string: dl=l!='dataLayer'?'&l='+l:'';, and change the ampersand (&) to its HTML encoded counterpart (&), so that the string looks like this: dl=l!='dataLayer'?'&amp;l='+l:'';.

This needs to be done, as the template format used in Blogger has a strict encoding schema, and unescaped or non-encoded special characters such as ampersand will cause errors in the template if not fixed.