-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Have you read the Contributing Guidelines on issues?
- I have 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.