I have a gatsby project setup and the gatsby-plugin-google-tagmanager setup in my gatsby-config.ts
using the following configuration:
...
{
resolve: 'gatsby-plugin-google-tagmanager',
// @see https://www.gatsbyjs.com/plugins/gatsby-plugin-google-tagmanager/
options: {
id: gtm.id,
includeInDevelopment: true,
defaultDataLayer: function () {
return {
env: gtm.env
}
},
routeChangeEventName: "page_vue",
}
},
...
When working in developpement mode, the dataLayer
script is injected in the <head>
and the <body>
but the pushes to the datalayer seems to have no effect and the routeChange event setup in the plugin configuration is not emitted.
I've tried using the tagassistant.google.com website, the dataSlayer
and tag assistant legacy
chrome plugins but both of them are acting as if the datalayer wasn't active or initialized. The events are fired and functional when the site is running on our developpement servers.