Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics 4 tag not appearing in <head> #3478

Closed
djenkins-nefco opened this issue Nov 20, 2023 · 3 comments
Closed

Google Analytics 4 tag not appearing in <head> #3478

djenkins-nefco opened this issue Nov 20, 2023 · 3 comments

Comments

@djenkins-nefco
Copy link

I've read through #2252 and it seems the end result there was the addition of this syntax:

extra:
  analytics:
    provider: google
    property: G-***********

However, when adding that to my mkdocs.yml and publishing, there is nothing in the <head> and Google doesn't detect the tag.

The Mkdocs guide still references google_analytics: ['UA-**********', 'site-name.org'], which must be old and the Material docs reference the same method above.

@orlasp
Copy link

orlasp commented Feb 22, 2024

I'm having the same issue. As another option I added a gtag.js file into the extra javascripts and pointed to that in the .yml but that didn't make any difference. Currently Analytics says "Your Google tag wasn't detected on your website." Any suggestions would be great.

@tomchristie
Copy link
Member

Let's close this off in favor of #3630

Including GA should be supported as a template override, not a config option.

@tomchristie tomchristie closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
@mhcpan
Copy link

mhcpan commented May 1, 2024

try this:

theme:
  name: mkdocs
  analytics:
    gtag: G-XXXXXXXXXX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants