DavidWells / DavidWells/analytics

Remove user_id as a custom dimension in google-analytics event payload

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.7k
Forks
267
PR merge metrics
No merged PRs in 30d

Description

I'm reviewing the recommendations from google on how to handle user_id for GA4 and it states the following:

It is recommended that you do not register a user ID as a custom dimension.
Creating unnecessary high-cardinality custom dimensions, like User ID, negatively impact your reports and cause data to aggregate under the (other) row

It looks like the user_id is already pushed to the datalayer in the way they recommend but it looks like we're also sending the user_id as a custom dimension in the finalPayload for page and track events.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace how the finalPayload is assembled for page and track events, and compare that with the existing datalayer handling for user_id. The change is done when user_id remains in the recommended datalayer path but is no longer included as a custom dimension in either event payload.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.