简体   繁体   中英

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. 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.

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. 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:

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.

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

But in my case, I can retrieve the client_id but receive "undefined" for the session_id...

Don't know why... :(

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.

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