Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mixpanel's "Simplified API" ID Merging #9

Open
kaleabmelkie opened this issue Dec 10, 2024 · 0 comments · May be fixed by #10
Open

Support for Mixpanel's "Simplified API" ID Merging #9

kaleabmelkie opened this issue Dec 10, 2024 · 0 comments · May be fixed by #10

Comments

@kaleabmelkie
Copy link

Looking at the current source code, it seems like only "Original API" mode is supported for Mixpanel ID management.

Simplified ID Merge docs: https://docs.mixpanel.com/docs/tracking-methods/id-management/migrating-to-simplified-id-merge-system

Essentially, it just uses the $device_id and $used_id properties in track events to identify users (no separate identify calls needed).

If a Mixplanel project is created using a "Simplified API" id merge mode (which can't be changed), and we pass $device_id, and $user_id, I think it's being replaced in the following line:

mixpanel/src/index.ts

Lines 159 to 162 in 3e0e5cf

properties: {
...customFields,
...getRequestBodyProperties(event, token),
},

Because ...getRequestBodyProperties(event, token) returns a $device_id property that has been set to a random UUID managed by this MC tool (in its own cookie), any $device_id we pass in the customFields is being overridden.


What do you think about switching the places so that any customField could replace the built-in ones, like this?

 properties: {
   ...getRequestBodyProperties(event, token),
   ...customFields,
 }, 

This way the $device_id and $user_id fields added to the tool settings (example: in Clodflare Zaraz dasboard) will have priority, and that way we can support "Simplified API" mode easily too?

Generally, I think customFields overriding any built-in properties the tool sets is a good and more intuitive idea.

Please let me know if I missed something. If this change is the only thing needed I can create a PR from a fork for it.

kaleabmelkie added a commit to kaleabmelkie/managed-component-mixpanel that referenced this issue Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant