DavidWells / DavidWells/analytics
What's the difference between `payload.userId` and `instance.user('userId')`? No way to reset google-tag-manager `userId` property
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
I don't quite understand where the payload.userId comes from here https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-google-tag-manager/src/browser.js#L81
Problem is once you called identify with a non null userId, there is absolutely no way to set it back to null. Neither calling identify() again without an userId nor calling analytics.reset() have any effect on this.
Every subsequent calls to track include a stale userId property...
What code is responsible of setting this userId property in the payload object? And why is this plugin using this instead of instance.user('userId')? What's the difference between the two?
Thanks :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at packages/analytics-plugin-google-tag-manager/src/browser.js around line 81 and trace where payload.userId is populated during identify, reset, and track. Reproduce the sequence described in the issue and verify that a later track call no longer includes a stale userId; clarify the difference between payload.userId and instance.user('userId').
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100