You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure what might be wrong. It works in development, but in production running window.Analytics.getState() I see this. All tracking requests are in the queue and never transmitted over to GA.
You can see the site live at https://lovemyvoice.app/. It's not localized to English yet, but that shouldn't matter. You can see analytics.ts file in devtools (source maps are included).
For the gatsby route plugin to work you need to set analytics to the window.
/* analytics.js */
import Analytics from 'analytics'
import segmentPlugin from 'analytics-plugin-segment'
import gtagManagerPlugin from 'analytics-plugin-google-tag-manager'
// ... whatever analytics provider you use
const analytics = Analytics({
plugins: [
gtagManagerPlugin({
containerId: 'GTM-XYZ'
}),
segmentPlugin({
writeKey: '123567',
}),
]
})
// Set to global so analytics plugin will work with Gatsby
if (typeof window !== 'undefined') {
window.Analytics = analytics
}
// Set to window.
window.Analytics = analytics
Sorry, I needed to deploy some working solution there. Ended up with a combination of gatsby-plugin-google-analytics along with a direct Firebase Analytics module (still deciding which one to keep). Both of those are working correctly, but the analytics module wasn't for some reason.
I guess I will close it here now. Thanks for the reply.
I am not sure what might be wrong. It works in development, but in production running
window.Analytics.getState()
I see this. All tracking requests are in the queue and never transmitted over to GA.You can see the site live at https://lovemyvoice.app/. It's not localized to English yet, but that shouldn't matter. You can see
analytics.ts
file in devtools (source maps are included).gatsby@2.23.12
analytics@0.5.5
@analytics/google-analytics@0.4.1
gatsby-plugin-analytics@0.2.0
The text was updated successfully, but these errors were encountered: