-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-plugin-google-tagmanager] Custom events, rather than limited to 'gatsby-route-change' #21362
Comments
Hi, could you explain why this would help your use case? You can add any tag to an event if I'm not mistaken so you should be just fine with gatsby-route-change. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hi @wardpeet, Some clients have specific naming conventions that they like to stick to. Although it is possible to fire events with any named tag event, to ensure consistency for the client it would be great to pass a custom name to this plugin. |
Hi, @robmarshallhome! If I understand it correctly the // gatsby-config.js
{
resolve: "gatsby-plugin-google-tagmanager",
options: {
id: "TAG_MANAGER_ID",
// Include GTM in development.
// Defaults to false meaning GTM will only be loaded in production.
includeInDevelopment: false,
// datalayer to be set before GTM is loaded
// should be an object or a function that is executed in the browser
// Defaults to null
defaultDataLayer: { platform: "gatsby" },
// Defaults to gatsby-route-change
routeChangeEventName: "CUSTOM_EVENT_NAME"
// More options...
},
}, I can take a look on this if @wardpeet agrees. |
@rbelow I have seen that in the options, but if you look at the gatsby-browser.js file, this option is not implemented. So the page change has the default name always. |
Ok. Seems clear to me. Should we then move forward on this? I would implement it if nobody disagrees. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
@rbelow we would welcome a PR to make that change, especially since there's an issue here discussing the use case. I'd say go for it! |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
@robmarshallhome the issue is now closed. I hope you and your clients enjoy the new feature. Cheers, |
The Google Tag Manager plugin currently uses a hardcoded event on a page change: 'gatsby-route-change'.
gatsby/packages/gatsby-plugin-google-tagmanager/src/gatsby-browser.js
Line 12 in 79326a5
To allow more flexibility, it would be great for users to add their own event for this. This could be managed within gatsby-config.js.
If this is a feature that interests you I would be happy to create a PR.
Thanks,
Rpb
The text was updated successfully, but these errors were encountered: