mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

Pass custom `device_id` to library initialization

Open andirsun opened this issue 3 months ago • 5 comments

Context about why we need this change:

  • In my case I am using Next Js + statsig platform to get values for certain A/B tests in our app.
  • When the app starts first Next js Middleware is fired (server side), so at this point I have to provide a custom device_id for the statsig to return me the A/B experiment values. At this point I can not initialize mixpanel here because the library is client side and not server side, so I have to create a custom device_id manually to pass to statsig. The problem is that I need this device_id to be attached to mixpanel cookie but not with an mixpanel.identify() but as device_id, I think the best solution will be to you allow us to pass device_id in the project initialization so we can control the format of the device_id based on what we need.

andirsun avatar Mar 25 '24 11:03 andirsun