Question

Tracking not working for iOS

  • 18 February 2019
  • 2 replies
  • 304 views

Badge

Hello,

we launched our app last week, and included Mixpanel to track events.

The app is developed using React Native and is available for iOS and Android.

We checked the number of users on our database and compared it with the data Mixpanel tracked. While on Android everything seems to work fine, iOS is tracking only about 10% of events.

It doesn't seem to be related to device or OS version, and it affects custom events as well as custom events.

We used MIXPANEL_NO_IFA on iOS, since we're not providing advertising on our app. Could this be a problem?



2 replies

Userlevel 5
Badge +3

@ulentini -

Using MIXPANEL_NO_IFA will only affect which value is used for the distinct_id when collecting events. If you are showing iAds in your application, you are allowed use the iOS ID

for Advertising (IFA) to identify users, and Mixpanel will use the IFA as the default distinct_id.

If you have do not want to use the IFA, you can define the

MIXPANEL_NO_IFA

flag in your Active Compilation Conditions build settings, and Mixpanel will use the IFV as the default distinct_id instead.

How are you setting your Mixpanel distinct_id? It is important to confirm that each unique user is getting assigned their own distinct_id when they send in events— otherwise it will seem as though fewer users are sending events.

Also, which SDK version are you using? Or, are you using a wrapper for React Native?

To collect Default Mobile Events you need to be on the following release of the mobile SDKs, or greater (Obj-C > 3.3.9, Android > 5.4.5, Swift > 2.5.8).

-Cherise



Badge

@ulentini, I've been experiencing the issue where some events were not being tracked from the iOS swift client. I would always get some events and then only sometimes get other events. I was really concerned. It turns out that the way I structured my code it was initializing the mixpanel instance multiple times per session. I figured this out by enabling logging and stepping into the mixpanel library code. The fix for me was to refactor my code to guarantee that a mixpanel instance would only be initialized once per session.

I used a "named" instance to make sure I got the right one:

let instanceName = "MyAnalytics"

if Mixpanel.getInstance(name: instanceName) == nil {

Mixpanel.initialize(token: "blahblahblah", launchOptions: nil, flushInterval: 60, instanceName: instanceName, automaticPushTracking: true, optOutTrackingByDefault: false)

}

instance = Mixpanel.getInstance(name: instanceName)!


Reply