通过测量协议发送Session_ID
我具有前端GA4实现,并希望通过MP从服务器发送交易数据(和一些自定义事件)。与Google提议的建议
将session_id作为参数,以便测量协议事件 出现在基于会话的报告
中
从gtag.js获得session_id或生成随机session_id?
I have front-end GA4 implementation and want to send transactions data (and some custom events) from the server via MP. With recomendations of Google to
include session_id as a param, so that measurement protocol events
appear in session-based reporting
is it better to get session_id from gtag.js or generate random session_id?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据 smarityment>“分析” A>使用“ Session_ID”参数的随机值将启动新的会话。
根据“ nofollow noreferrer”>测量协议(Google Analyticals 4)/changelog '>'>'>'>'>'> Session_ID'需要在基于会话的报告中获取服务器端事件。
解决方案:
'会话ID'存储在cookie中,似乎是会话开始日期的时间戳。使用PHP在服务器端获取“会话ID”:
According to Measurement Protocol (Google Analytics 4)/Sending events using random value for 'session_id' parameter will start new session.
According to Measurement Protocol (Google Analytics 4)/Changelog 'session_id' is required to get server-side events in session-based reports.
Solution:
'Session Id' is stored in cookies and seems it's a timestamp of session start date. To get 'Session Id' at server side using PHP:
为了使GA4能够将事件归因于原始会话,您应该提供
session_id
。它可以通过gtag
:资源:
In order for GA4 to be able to attribute the event to the original session, you should provide the
session_id
. It can be retrieved throughgtag
:Resources:
我想我在这里找到了解决方案 https://www.optimiessmart.com/what-is-measurement-protocolotocol-in-google-in-google-analytics-4-ga4/#11-10-10-sessision-id-id--
请求GA的请求中的参数:
I think I found the solution here https://www.optimizesmart.com/what-is-measurement-protocol-in-google-analytics-4-ga4/#11-10-session-id-
There 2 params in the request to GA: