Closed
Description
I've integrated Firebase into the react application where GTM is already used. When I'm trying to log some event for the first time it crashes:
import firebase from 'firebase/app'
firebase.initializeApp({
apiKey: '...',
authDomain: '...',
databaseURL: '...',
projectId: '...',
storageBucket: '...',
messagingSenderId: '...',
appId: '...',
measurementId: '...',
})
...
firebase.analytics().logEvent('custom_event', {
login: 'login',
})
The error I see in the console at the moment the above event is sent:
gtm.js?id=GTM-M4SMHQD>m_auth=>m_preview=>m_cookies_win=x:292 Uncaught TypeError: Cannot read property 'containerId' of undefined
at Pl (gtm.js?id=GTM-M4SMHQD>m_auth=>m_preview=>m_cookies_win=x:292)
at Hl.aa.flush (gtm.js?id=GTM-M4SM...>m_auth=>m_preview=>m_cookies_win=x:299)
at Hl.aa.push (gtm.js?id=GTM-M4SM...>m_auth=>m_preview=>m_cookies_win=x:297)
at Kl (js?l=dataLayer&id=G-ERXSK...:175)
at config (js?l=dataLayer&id=G-ERXSK...:186)
at Tm (js?l=dataLayer&id=G-ERXSKR...:195)
at Um (js?l=dataLayer&id=G-ERXSK...:195)
All the subsequent calls of logEvent
work just fine.
And here is how I'm using GTM:
import TagManager from 'react-gtm-module'
TagManager.initialize({
gtmId: '...',
})
"firebase": "^8.4.1",
"react-gtm-module": "^2.0.11",
I would appreciate any help on that.