managed-components / managed-components/google-analytics-4
User ID gets ignored
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
## Expectation
If you set User ID in the MC parameters, it should get sent, and be observable in GA4 BigQuery exports.
## Observations
If you set `User ID` in the config, it gets sent with server side requests (as `uid`).
It's a little hard to tell if this works, because it doesn't show up in the DebugView in GA4. However, if you GA4 exporting to BigQuery, there's a `user_id` column for events. I found this was always `null` despite getting sent to GA4.
I have been troubleshooting by also firing requests client side with `gtag`, but was unable to figure out why the `uid` from the request wasn't showing up. The client side requests looks a bit similar, but is sent to another domain, and has many different parameters in addition to overlapping ones. Notably, the client side request with `user_id` set in the JavaScript, did map to a `uid` URL param also.
For the GA4 MC, I tried passing `G111` for consent manually, setting custom params `uid` and `user_id` manually (not what we want since it sets event params).
For events sent client side, I was able to observe in BigQuery in seconds, which also confirms there's no config issue related to my tracker or property.
## Potential solution
It seems like a lot of the current implementation is reverse engineered and depends unpublished API details to mimic a client side tag. However, there's a stable and published API for server side events. #17 (but for all events, except audiences), could solve this.
Contributor guide
No contributing guide indexed for this repository
Research direction
No files or tests are named. Start by tracing how the MC User ID becomes the server-side `uid`, then read issue #17 and compare the current implementation with the published server-side events API. Done means configured User ID values appear as `user_id` in GA4 BigQuery exports for supported events.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100