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

[Mixpanel] Allow extracting distinct ID, and identifying users #5

Closed
dimitrisnl opened this issue Apr 11, 2019 · 1 comment
Closed

Comments

@dimitrisnl
Copy link
Contributor

What needs to be done

In the consumer, we don't expose the mixpanel library at all.

In order to have proper cross-domain tracking, we need a) to extract the user's distinct_id from the Mixpanel instance [1]

mixpanel.init("YOUR PROJECT TOKEN", {
  loaded: function(mixpanel) {
    distinct_id = mixpanel.get_distinct_id();
  }
});

and then pass it along as a URL property in the next website.

b) In the destination, before doing any other calls, we have to associate the two sessions

mixpanel.identify(distinct_id)

Ideas

It's tricky because we have the same API for all three libraries (login, logout, track), and this calls for something mixpanel specific. One option would be to expose all the libraries to the client. Ideally, I would like to avoid this and have getAnonymousId, identifyVisitor that handle all three platforms.

Mixpanel docs

[1] https://help.mixpanel.com/hc/en-us/articles/115004511006-Track-Users-Across-Domains
[2] https://help.mixpanel.com/hc/en-us/articles/360000791746-Tracking-Truly-Anonymous-Data

@dimitrisnl
Copy link
Contributor Author

dimitrisnl commented Apr 11, 2019

There are some issues, that is blocking it

https://www.npmjs.com/package/mixpanel

Where is mixpanel.identify()?

mixpanel-node is a server-side library, optimized for stateless shared usage; e.g., in a web application, the same mixpanel instance is used across requests for all users. Rather than setting a distinct_id through identify() calls like Mixpanel client-side libraries (where a single Mixpanel instance is tied to a single user), this library requires you to pass the distinct_id with every tracking call. See https://github.com/mixpanel/mixpanel-node/issues/13.]

The get_distinct_Id isn't present.

That being said resin-mixpanel-client tries to combine both the browser & the node libraries.

dimitrisnl added a commit that referenced this issue Apr 11, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 11, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 11, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 12, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 15, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 17, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 18, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 19, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 19, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 19, 2019
Connects-to: #5
Change-type: major
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 19, 2019
Connects-to: #5
Change-type: minor
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
dimitrisnl added a commit that referenced this issue Apr 19, 2019
Connects-to: #5
Change-type: minor
Signed-off-by: Dimitrios Lytras <dimitrios@balena.io>
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

No branches or pull requests

1 participant