Mixpanel-AppExtension 3.2.2

Mixpanel-AppExtension 3.2.2

TestsTested
LangLanguage Obj-CObjective C
License Apache 2
ReleasedLast Release Oct 2017

Maintained by Yarden Eitan, Peter Chien.



  • By
  • Mixpanel, Inc

Table of Contents

Introduction

The Mixpanel library for iOS is an open source project, and we'd love to see your contributions! We'd also love for you to come and work with us! Check out https://mixpanel.com/jobs/#openings for details.

If you are using Swift, we recommend our Swift Library.

Installation

iOS, tvOS, watchOS, macOS:

pod 'Mixpanel'

App Extension:

pod 'Mixpanel-AppExtension'

Manual Installation

To help users stay up to date with the latests version of our iOS SDK, we always recommend integrating our SDK via CocoaPods, which simplifies version updates and dependency management. However, there are cases where users can't use CocoaPods. Not to worry, just follow these manual installation steps and you'll be all set.

Step 1: Add as a submodule

Add Mixpanel as a submodule to your local git repo like so:

git submodule add [email protected]:mixpanel/mixpanel-iphone.git

Now the Mixpanel project and its files should be in your project folder!

Step 2: Add the SDK to your app!

Drag and drop Mixpanel.xcodeproj from the mixpanel-iphone folder into your Xcode Project Workspace:

alt text

Step 3: Import the Mixpanel framework

Add Mixpanel.framework under "Linked Frameworks and Libaries" to your app.

alt text

Integrate

Import <Mixpanel/Mixpanel.h> into AppDelegate.m, and initialize Mixpanel within application:didFinishLaunchingWithOptions:

#import "AppDelegate.h"
#import <Mixpanel/Mixpanel.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Mixpanel sharedInstanceWithToken:MIXPANEL_TOKEN];
}

You initialize your Mixpanel instance with the token provided to you on mixpanel.com.

Start tracking

After installing the library into your iOS app, Mixpanel will automatically collect common mobile events. You can enable/ disable automatic collection through your project settings.

Tracking additional events is as easy as adding track: or track:properties: anywhere after initializing Mixpanel.

[[Mixpanel sharedInstance] track:@"Event name"];
[[Mixpanel sharedInstance] track:@"Event name" properties:@{@"Prop name": @"Prop value"}];

You're done! You've successfully integrated the Mixpanel SDK into your app. To stay up to speed on important SDK releases and updates watch our iPhone repository on Github.

Have any questions? Reach out to [email protected] to speak to someone smart, quickly.