我编写了一个 python 脚本来获取网站上的活跃用户数量,但我最近发现从 GA4 获取的数量少于常规 GA 的数量。
作为信息,我获取了过去 5 分钟内的活跃用户数,我认为在计算活跃用户数时,这是有关 GA 的正确数字。
如果我获得默认持续时间(30 分钟),那么我会获得更多数据。
举个例子,在 GA 中,我目前有“310”个活跃用户,但在 GA4 上,我在过去 5 分钟内有“83”个活跃用户,在过去 30 分钟内有“448”个活跃用户。
这是我的代码:
#Runs a realtime report on a Google Analytics 4 property.
client = BetaAnalyticsDataClient()
#Run the request.
request = RunRealtimeReportRequest(
property=f"properties/{property_id}",
metrics=[Metric(name="activeUsers")],
minute_ranges=[MinuteRange(start_minutes_ago=29, end_minutes_ago=0)]
)
#Parse the response.
response = client.run_realtime_report(request)
最佳答案
这两个版本测量的内容并不相同,GA4 预计会向更多用户展示:
The Realtime report in Google Analytics 4 properties counts users who engaged with your app/site for any non-zero amount of time during the previous 30 minutes, while the Streamview (realtime) report in Universal Analytics Standard/360 properties counts any user who triggered an event during the previous five minutes.
关于google-analytics - 与常规 Google Analytics 相比,从 GA4 获取的数据不准确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68577919/