I have React SPA when I use gtag to track users in Google Analytics. I am confused with data which I see in Real-Time Google Analytics. When app starts or user is routed to new react route I fired event like this to set correct page and log pageView
window.gtag('config', UA-123456789-1, {
groups: 'MYGROUP',
page_path: '/contacts',
})
When user click on button or make some interesting action I fire event like this
window.gtag('event', 'Some button click', {
sendTo: 'MYGROUP',
event_category: 'buttons on main page',
})
Many events is button click on page one and this click move user to another page (on this new page is fired gtag configure). When I watch events in Real-Time Analytics page view, pages is shown like one page delayed. For example gtag events flow and RealTime result
Do you know why this happen or do you have some tips how to fix it? I need log both events and pageView. I am not sure where this delay starts. In some cases I see for example first two pages correctly and third is delayed, sometimes is delayed from first event. Event and configure is fired close together. Many thanks
鉴于它是一个 SPA,您应该按照此处的规定手动发送综合浏览量: https : //developers.google.com/analytics/devguides/collection/gtagjs/pages#page_view_event 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.