Google Tag Manager Integration

A few question regarding google tag manager. I was using the google tag manager analytics plugin and it seems to work fine in regards to loading up tags.

However, i have had some people try to verify our website on the Google Search Console, and the verification via Tag Manager failed.

After some digging, referencing this: Quick Start Guide  |  Google Tag Manager for Web Tracking it appears using the Google Tag Manager Analytics package doesn’t implement integration according to this spec, and due to the no-script tag not being present (or atleast I cannot find), the search verification fails.

Verify your site ownership - Search Console Help. See. notes on body tag.

My primary question is how can I include google tag manager according to google’s spec in the context of frontity; is it even possible? Google spec being, script at the top of head section and iframe tag following the opening body tag.

How do you all verify your domain on the google search console?

Hi folks!

I had a look at this and the google tag manager noscript element is indeed being included in the page. I’m talking about this snippet:

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Just FYI the frontity code which does this is here.

However, it seems to me that we are failing to follow the guidelines on at least 2 points:

  1. The styles are added using emotion (so the snippet is not exactly the same, although I’m not 100% sure if this is actually causing any problems)

  2. The snippet is not placed immedately after the opening <body> tag.

@brandonleejennings I will open a bug to fix those and once it’s merged it would be great if you could confirm to us that it indeed fixes the issue for your users.

Also, I see that we’re using Google Tag Manager analytics package on frontity.org so perhaps it is working correctly after all.

@SantosGuillamot Have you experienced any issues with respect to the what is reported above?

Opened the issue to track this: It is not possible to verify ownership of a site using the Google Tag Manager package. · Issue #820 · frontity/frontity · GitHub

I don’t remember how which method we used to verify it but right now it’s working correctly. Taking a look at the different methods, the easiest way to verify the ownership seems to be adding the html tag in the <head>. I guess you should be able to easily do it just by using Frontity component. Something similar to this:

<Head>
    <meta name="google-site-verification" content="your verification string">
</Head>

Have you tried that method @brandonleejennings ?

1 Like

I have not. We used the domain .txt file verification.

This has also come up now, it seems being able to place specific pieces of code around the dom is becoming a requirement:

Thanks. I’ll keep an eye out. Happy to help out.