The Google Tag Manager plugin currently uses a hardcoded event on a page change: 'gatsby-route-change'.
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
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鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
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-plugin-google-tagmanager should have a plugin option where you can pass your custom event name like in this example:
// 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鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
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鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Most helpful comment
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.