Skip to content

Add a Google Tag Manager plugin to enhance the current gtag plugin #8471

Closed

Description

@lanegoolsby

Have you read the Contributing Guidelines on issues?

Description

This issue will be for discussing #8470, a PR for adding docusaurus-plugin-google-tag-manager as a supplemental plugin for docusaurus-plugin-gtag.

Has this been requested on Canny?

No response

Motivation

The current Google Analytics plugin will no longer be usable in a few months since GA3 will stop processing data in June this year (see #7221 for additional context).

The gtag plugin is a 'good enough' solution for basic site metrics but in order to get in-depth stats that were once available with the previous Google Analytics product you have to use Google Tag Manager. For example, to see when a user clicks a specific button on the page, the site has to be configured to use GTM.

Supporting docs:

https://support.google.com/tagmanager/answer/6103696?hl=en
https://www.analyticsmania.com/post/track-clicks-with-google-analytics-4-and-gtm/
https://zozimus.com/how-to-track-a-button-click-event-in-google-analytics-using-google-tag-manager/

API design

This behaves the same way as the current gtag plugin. The only differences are the plugin name, property names, etc. (and the scripts that get injected, obviously).

I have also included draft documentation for docusaurus.io with implementation details.

Have you tried building it?

The code builds, I can see my documentation using yarn start, and I do not see any console errors when using yarn serve.

I am publishing the core logic of this package to my company's internal npm registry as its own package and it works fine. I'm sharing the core logic since others seem to be interested in it, it's pretty bog-standard, and I love this community. :)

Before signing off on this PR someone with admin rights to the DS Google Analytics account will need to setup a GTM account tied to their gtag Id. I provided the links I used for setting up and testing my internal package but there's plenty other examples available.

I'm sure there's some secret sauce I'm missing in getting a new package wired into the build process.

Self-service

  • I'd be willing to contribute this feature to Docusaurus myself.

Activity

  1. added
    feature
    status: needs triage
    on Dec 21, 2022
  2. changed the title [-]Deprecate Google Analytics plugin and replace it with Google Tag Manager[/-] [+]Add a Google Tag Manager plugin to enhance the current gtag plugin[/+] on Dec 21, 2022
  3. slorber commented on Dec 21, 2022

    @slorber
    Collaborator

    👍

    Agree we need this plugin and have also implemented it on my newsletter website thisweekinreact.com

  4. removed
    status: needs triage
    on Dec 21, 2022
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

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions