mixpanel / mixpanel-swift

Official iOS (Swift) Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
435 stars 234 forks source link

Documentation not clear for use in app extensions #75

Closed mxcl closed 7 years ago

mxcl commented 7 years ago

I have an iOS app, a watchOS extension, a message extension, a today extension and a notification extension.

Should I be specifying just:

pod 'Mixpanel-swift-appex', '~> 2.0'

or:

pod 'Mixpanel-swift', '~> 2.0'

For the app and the Mixpanel-swift-appex variant for the extension targets?

Will the distinct-id for my integration be the same across all the apps and extensions? Or is extra work required to achieve that. Thanks.

yarneo commented 7 years ago

Hi @mxcl For the app extension targets that use the iOS platform; i.e. your message/today/notification extensions, you should be using pod 'Mixpanel-swift-appex', '~> 2.0' For your actual iOS app target, you should be using: pod 'Mixpanel-swift', '~> 2.0' When you say watchOS extension, do you mean an app displayed on the watch? If so, we currently don't support the watchOS platform in our swift repo, but do support it in the Objective-C repo.

As for the DistinctID, if you identify everywhere with a distinctID that's unique for that user, it should show up in Mixpanel as the same user. Also, if you don't identify initially and use the default DistinctID we provide for each user, that should theoretically work as well. The reason being, is that the logic behind it is we either take the IDFA (which is the Ad identifier if you have AdSupport included in your app), or we fallback to the IdentifierForVendor. Both of these methods output the same DistinctID if the apps/extensions are in the same device and are in the app store from the same vendor.

mxcl commented 7 years ago

Great, I'm clear now, thanks.