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

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

Closed
2 tasks done
lanegoolsby opened this issue Dec 21, 2022 · 1 comment · Fixed by #8470
Closed
2 tasks done

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

lanegoolsby opened this issue Dec 21, 2022 · 1 comment · Fixed by #8470
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@lanegoolsby
Copy link
Contributor

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.
@lanegoolsby lanegoolsby added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Dec 21, 2022
@lanegoolsby lanegoolsby 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 Dec 21, 2022
@slorber
Copy link
Collaborator

slorber commented Dec 21, 2022

👍

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
2 participants