简体   繁体   English

Gtag 和 Google Analytics 事件和网页浏览量衡量

[英]Gtag and Google Analytics events and page view measurement

I have React SPA when I use gtag to track users in Google Analytics.当我使用 gtag 在 Google Analytics 中跟踪用户时,我有 React SPA。 I am confused with data which I see in Real-Time Google Analytics.我对在实时 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当应用程序启动或用户被路由到新的反应路线时,我触发了这样的事件来设置正确的页面并记录 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).许多事件是在第一页上单击按钮,然后单击将用户移动到另一个页面(在这个新页面上触发 gtag 配置)。 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例如 gtag 事件流和实时结果

  • gtag Configure page "/about" -> in GA is showing /about gtag 配置页面“/about”-> 在 GA 中显示 /about
  • gtag Event "signIn click" (move user to sign in) gtag 事件“登录点击”(移动用户登录)
  • gtag Configure page "/signin" -> in GA is showing /about gtag 配置页面“/signin”-> 在 GA 中显示 /about
  • gtag Event "contacts click" (move user to contacts) gtag 事件“联系人点击”(将用户移至联系人)
  • gtag Configure page "/contacts" -> in GA is showing /signIn gtag 配置页面“/contacts”-> 在 GA 中显示 /signIn

Do you know why this happen or do you have some tips how to fix it?你知道为什么会发生这种情况,或者你有一些解决方法的技巧吗? I need log both events and pageView.我需要记录事件和 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法禁用 Google Analytics page_view 事件 - Can't disable Google Analytics page_view events 在 React 中添加谷歌分析 gtag 代码片段 - Add google analytics gtag code snippet in React 将 Google Analytics 测量 ID 与 React JS 集成 - Integrate Google Analytics Measurement Id with React JS gtag:为什么谷歌分析即使没有被授权也会收集数据 - gtag: why does google analytics collects data even if not granted 谷歌分析仅在页面刷新时更新页面视图 - Google analytics only update page view when page is refreshed 在基于 React 的 Chrome 扩展中实现 Google Analytics gtag.js 时遇到问题 - Trouble implementing Google Analytics gtag.js in React-based Chrome Extension GA4 谷歌分析。 gtag.js 发送请求有几秒钟的延迟,而不是立即 - GA4 Google Analytics. gtag.js sends a request with a delay of a few seconds, not instantly Google Analytics 4 不会在虚拟页面视图上发送 `page_view`(`hashchange` 源的`historyChange` 事件) - Google Analytics 4 doesn't send `page_view` on virtual page views (`historyChange` event for `hashchange` source) React Google Analytics - 事件发送但不显示 - React Google Analytics - Events sending but not showing up Gatsbyjs + Google 分析 - 跟踪自定义事件? - Gatsbyjs + Google analytics - tracking custom events?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM