You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We have 2 different sources set up for sending unauthenticated vs. authenticated events. It's set up this way so we can limit damage, in case the keys are compromised. If user is signed out, events are sent to the unauthenticated source. Once the user signs in, we initialize another instance of Analytics with the appropriate write keys, and send events to the authenticated source. The unauthenticated Analytics instance is killed. This causes some issues with 2 different device_ids being created for each instance and identity merge not happening correctly (we're forwarding to Mixpanel with the simplified API).
Describe the solution you'd like
It would be great if we only had to initialize Analytics once, but could change the write key based on the user's state (signed out/in).
Describe alternatives you've considered
We could consider generating the device_id ourselves and setting it to be the same value explicitly for each instance of Analytics (and resetting it when the user signs out)
The text was updated successfully, but these errors were encountered:
The system is not setup to work this way and I would recommend against what you're attempting to do. If you're concerned about your write key leaking somehow, it's best to download it on app launch or something instead. You'd download store it in the keychain and use it until you knew it changed.
Keeping two instances of analytics in sync w/ the same anonId, user, etc probably isn't ever going to work reliably. What you're attempting to do makes your implementation incredibly complex for something that's very unlikely to / won't ever happen.
Is your feature request related to a problem? Please describe.
We have 2 different sources set up for sending unauthenticated vs. authenticated events. It's set up this way so we can limit damage, in case the keys are compromised. If user is signed out, events are sent to the unauthenticated source. Once the user signs in, we initialize another instance of Analytics with the appropriate write keys, and send events to the authenticated source. The unauthenticated Analytics instance is killed. This causes some issues with 2 different
device_id
s being created for each instance and identity merge not happening correctly (we're forwarding to Mixpanel with the simplified API).Describe the solution you'd like
It would be great if we only had to initialize Analytics once, but could change the write key based on the user's state (signed out/in).
Describe alternatives you've considered
We could consider generating the
device_id
ourselves and setting it to be the same value explicitly for each instance of Analytics (and resetting it when the user signs out)The text was updated successfully, but these errors were encountered: