#GTMTips: Add Google Tag Manager To Your Blogger Blog
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.
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
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:
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.