iosobjective-canalyticsmixpanelevent-tracking

Mixpanel integrated in iOS SDK is not sending events


​I have an iOS SDK project with lots of modules (in Objective-C). I want to start tracking events to see how my clients use our SDK but I can't see anything in the insights tab. What am I doing wrong?  

enter image description here

In the point of entry to the SDK I have added this (just following the docs):

   [Mixpanel sharedInstanceWithToken:@"myTOKEN"];
   self.mixpanel.serverURL = @"https://api-eu.mixpanel.com";

    [self.mixpanel track:@"Video play" properties:@{
        @"genre": @"hip-hop",
        @"duration in seconds": @42,
    }];

I can see with breakpoints that the code it’s executed, however my insights are completely empty.

I also tried adding events with the codeless tracking, and while it looks like it’s working and I can connect to the app, the events aren’t appearing in the insights tab.

 enter image description here


Solution

  • I think you need to assign the shared instance to your local property if that hasn't been done outside of the code you've posted.

       [Mixpanel sharedInstanceWithToken:@"myTOKEN"];
       self.mixpanel = [Mixpanel sharedInstance]; // assign here
       self.mixpanel.serverURL = @"https://api-eu.mixpanel.com";
    
        [self.mixpanel track:@"Video play" properties:@{
            @"genre": @"hip-hop",
            @"duration in seconds": @42,
        }];