GA4 report not showing since 2nd of September
I'm encountering an issue with Google Analytics 4 where events sent via window.dataLayer() from my codebase are not appearing in the GA4 reports. It's important to note that all default events created by Google Tag Manager (GTM) are functioning as expected.
Thank you in advance for your help!
This problem arose suddenly on September 2nd, without any changes to the codebase. Prior to this, everything was working smoothly on both August 29th and 30th.
const acceptTracking = xxxxx
export default function useInitGA() {
const isAcceptGATracking = xxxxx.acceptGATracking
const isAcceptCookies = xxxxx.acceptCookies
const initGtag = () => {
const existingScript = document.getElementById('test-gtag')
if (!existingScript && isAcceptGATracking && isAcceptCookies) {
console.log('initialized GTag!')
const gaScript = document.createElement('script')
gaScript.src = https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}
gaScript.async = true
gaScript.id = 'test-gtag'
document.getElementsByTagName('head')[0].appendChild(gaScript)
window.dataLayer = window.dataLayer || []
function gtag() {
window.dataLayer.push(arguments)
}
// @ts-ignore
gtag('js', new Date())
// @ts-ignore
gtag('config', GA_MEASUREMENT_ID, { cookie_flags: 'secure;samesite=none' })
}
}
const initGTM = () => {
const existingScript = document.getElementById('test-gtm')
if (!existingScript && isAcceptGATracking && isAcceptCookies) {
console.log('initialized GTM!')
const gaScript = document.createElement('script')
gaScript.src = https://www.googletagmanager.com/gtm.js?id=${GA_GTM_ID}
gaScript.async = true
gaScript.id = 'test-gtm'
document.getElementsByTagName('head')[0].appendChild(gaScript)
window.dataLayer = window.dataLayer || []
window.dataLayer.push({
'gtm.start': new Date().getTime(),
event: 'gtm.js',
})
}
}
useEffect(() => {
initGTM()
initGtag()
}, [isAcceptGATracking])
}
function gtag() {
if (acceptTracking !== false) {
window.dataLayer.push(arguments)
}
}
I'm seeking assistance to understand if there might be an issue with GA4 causing this event tracking problem. Any insights or guidance on troubleshooting steps would be greatly appreciated.
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand