Skip to content

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

Closed as not planned
Closed as not planned

Description

@djenkins-nefco

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.

Activity

  1. orlasp commented on Feb 22, 2024

    @orlasp

    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.

  2. lovelydinosaur commented on Apr 12, 2024

    @lovelydinosaur
    Collaborator

    Let's close this off in favor of #3630

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

  3. mhcpan commented on May 1, 2024

    @mhcpan

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions