I'm using gatsby and the gatsby-plugin-tag-manager and I'm having trouble getting custom events to trigger. My gatsby-config.js looks like this:
{
resolve: `gatsby-plugin-google-tagmanager`,
options: {
id: 'GTM-XXXXXXX',
includeInDevelopment: true,
defaultDataLayer: function() {
return {
pageType: window.pageType,
// platform: 'gatsby',
}
},
},
When I run everything locally, I can get my events to trigger properly using this code:
window.dataLayer.push({
event: 'gatsby-course-splash-sign-up',
})
The problem is that when I deploy it statically to an s3 bucket instead of running on a server, while the page views trigger, nothing else does. Does anyone know how to get custom triggers to work? Thanks!