简体   繁体   English

如何手动获取GA4 linker参数(_gl)

[英]How to manually get the GA4 linker parameter (_gl)

I'm working on upgrading an app from using Universal Analytics to use Google Analytics 4. I need to be able to provide cross-domain tracking since my app navigates users to 3rd parties.我正在将应用程序从使用 Universal Analytics 升级到使用 Google Analytics 4。我需要能够提供跨域跟踪,因为我的应用程序将用户导航到第 3 方。 I have configured all of the domains within the data stream in Google Analytics (followed steps in https://support.google.com/analytics/answer/10071811 ), and when I navigate to the configured domains through basic navigation (ie anchor tag with href), I do see the _gl=<> linker parameter appended properly to the URL.我已经在 Google Analytics 中配置了数据 stream 中的所有域(按照https://support.google.com/analytics/answer/10071811中的步骤),当我通过基本导航导航到配置的域时(即锚标记使用 href),我确实看到 _gl=<> linker 参数正确附加到 URL。

My problem is that navigation to the 3rd party domain I want to track is done through a html form post, and the linker parameter is not being appended to the URL as it does through navigating via href.我的问题是导航到我要跟踪的第 3 方域是通过 html 表单帖子完成的,并且 linker 参数没有被附加到 ZE6B391A8D2C4D45902A23A8B65857 的 ZE6B391A8D2C4D45902A23A8B65857 中。 In the past with the existing Universal Analytics implementation, I have been able to manually attach the linker parameter to the URL by using the ga page object and calling:在过去使用现有的 Universal Analytics 实施时,我已经能够通过使用 ga 页面 object 并调用手动将 linker 参数附加到 URL 并调用:

ga.getAll()[0].get('linkerParam')

However, I can't seem to find the equivalent API that I can use to get the _gl parameter to add to my URL for tracking with Google Analytics 4.但是,我似乎找不到等效的 API 可用于获取 _gl 参数以添加到我的 URL 以使用 Google Analytics 4 进行跟踪。

Can anyone provide any advice on how I can overcome this issue?任何人都可以就我如何克服这个问题提供任何建议吗?

I found this answer from Google: https://support.google.com/analytics/answer/10071811?hl=en#zippy=%2Cmanual-setup我从谷歌找到了这个答案: https://support.google.com/analytics/answer/10071811?hl=en#zippy=%2Cmanual-setup

But in my case, I can retrieve the client_id but receive "undefined" for the session_id...但就我而言,我可以检索 client_id 但会收到 session_id 的“未定义”...

Don't know why... :(不知道为什么... :(

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM