Each week, Mixpanel will release articles from our archives to help you get the most out of Mixpanel. Follow the Topic Tag #fromthearchive to subscribe to these posts and get alerted when they drop.
Mixpanel Messages are automatically set up to be delivered only once to a user for a given campaign. Push notifications, however, are delivered once per device token stored on the profile. Each of your users may have more than one device they use to access your application. The device token is akin to a phone number; it tells Apple/GCM to which device they should deliver the message.
A common reason a user can have multiple device tokens is if they use your app both on their phone and their tablet - in this case, barring any targeting restrictions by device, the user would receive your message in both places.
Another culprit of seeing more than just a few device tokens on one profile can also be the user uninstalling and reinstalling the app multiple times. The result can look something like this:
On each new app install, a new token is added to the user's Mixpanel profile. Then, when a push is sent targeted at this user, Mixpanel sends one message for each device token for the user.
Although Mixpanel marks the push notification as having been sent N times (N being the number of tokens on that user’s profile), old tokens get invalidated when sending, so the end user would only receive the push notification once, although they will see it on each active device. Learn more about how Mixpanel manages push tokens when they are invalid or when the app has been uninstalled.
One final cause of seeing many device tokens on one profile can be a problem with assigning the same distinct_id to multiple users (what is distinct_id?). If this is happening, you’ll want to take a close look at how you’re managing user identity to ensure each People Profile has information for only one unique user - read more about managing user identity in Mixpanel.
Remove Push Tokens
There are two methods for removing push tokens from your profiles: removeAllPushDeviceTokens and removePushDeviceToken. With these methods you can remove individual tokens from your profiles or remove all tokens from your profiles prior to adding a new token with the addPushDeviceToken method. You can also remove tokens using the $remove HTTP operation (scroll down to "Update Operations").