All Projects → mixpanel → Mixpanel Iphone

mixpanel / Mixpanel Iphone

Licence: other
iPhone tracking library for Mixpanel Analytics

Projects that are alternatives of or similar to Mixpanel Iphone

Amplitude Ios
Native iOS/tvOS/macOS SDK
Stars: ✭ 216 (-77%)
Mutual labels:  analytics, sdk, cocoapods, carthage
Contentful.swift
A delightful Swift interface to Contentful's content delivery API.
Stars: ✭ 132 (-85.94%)
Mutual labels:  sdk, cocoapods, carthage
Mixpanel Swift
Official iOS (Swift) Tracking Library for Mixpanel Analytics
Stars: ✭ 294 (-68.69%)
Mutual labels:  analytics, sdk, cocoapods
Auth0.swift
Swift toolkit for Auth0 API
Stars: ✭ 146 (-84.45%)
Mutual labels:  sdk, cocoapods, carthage
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (-39.3%)
Mutual labels:  sdk, cocoapods, carthage
Gradients
🌔 A curated collection of splendid 180+ gradients made in swift
Stars: ✭ 719 (-23.43%)
Mutual labels:  cocoapods, carthage
Zephyr
Effortlessly synchronize UserDefaults over iCloud.
Stars: ✭ 722 (-23.11%)
Mutual labels:  cocoapods, carthage
Blockhook
Hook Objective-C blocks. A powerful AOP tool.
Stars: ✭ 742 (-20.98%)
Mutual labels:  cocoapods, carthage
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (-13.84%)
Mutual labels:  cocoapods, carthage
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (-28.75%)
Mutual labels:  cocoapods, carthage
Nightnight
Elegant way to integrate night mode to swift projects
Stars: ✭ 771 (-17.89%)
Mutual labels:  cocoapods, carthage
Cascadingtabledelegate
A no-nonsense way to write cleaner UITableViewDelegate and UITableViewDataSource in Swift.
Stars: ✭ 931 (-0.85%)
Mutual labels:  cocoapods, carthage
Koyomi
Simple customizable calendar component in Swift 📆
Stars: ✭ 716 (-23.75%)
Mutual labels:  cocoapods, carthage
Shiny
Iridescent Effect View (inspired by Apple Pay Cash) ✨
Stars: ✭ 707 (-24.71%)
Mutual labels:  cocoapods, carthage
Defaults
Swifty and modern UserDefaults
Stars: ✭ 734 (-21.83%)
Mutual labels:  cocoapods, carthage
Validatedpropertykit
Easily validate your Properties with Property Wrappers 👮
Stars: ✭ 701 (-25.35%)
Mutual labels:  cocoapods, carthage
Xlpagertabstrip
Android PagerTabStrip for iOS.
Stars: ✭ 6,671 (+610.44%)
Mutual labels:  cocoapods, carthage
Sdwebimageflplugin
A SDWebImage plugin to support GIF using FLAnimatedImage and category
Stars: ✭ 16 (-98.3%)
Mutual labels:  cocoapods, carthage
Dockprogress
Show progress in your app's Dock icon
Stars: ✭ 813 (-13.42%)
Mutual labels:  cocoapods, carthage
Swipemenuviewcontroller
Swipable tab and menu View and ViewController.
Stars: ✭ 926 (-1.38%)
Mutual labels:  cocoapods, carthage

Build Status Average time to resolve an issue Percentage of issues still open CocoaPods Version Carthage compatible Apache License

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

CocoaPods

Mixpanel supports CocoaPods for easy installation. To Install, see our full documentation »

iOS, tvOS, watchOS, macOS:

pod 'Mixpanel'

Carthage

Mixpanel also supports Carthage to package your dependencies as a framework. Check out the Carthage docs » for more info.

To integrate Mixpanel into your Xcode project using Carthage, specify it in your Cartfile:

github "mixpanel/mixpanel-iphone"

Run carthage update to build the framework and drag the built Mixpanel.framework into your Xcode project.

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: Embed the Mixpanel framework

Select your app .xcodeproj file. Under "General", add the Mixpanel framework as an embedded binary. Once added, please make sure Mixpanel.framework shows under both "Linked Frameworks and Libaries" and "Embedded Binaries".

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.

Using Mixpanel Push Notifications

First enable Mixpanel push notifications in your app. Then for Rich Push Notifications, you'll need to integrate your application with the MixpanelNotificationServiceExtension.

Integrating the MixpanelNotificationServiceExtension

The Mixpanel SDK comes with a custom Notification Service Extension used to render rich media, custom action buttons, and track when push notifications are received. In order to enable these features, you will need to integrate it into your application.

1. Create a new Notification Service Extension Target

Screenshot 2020-02-13 14 46 53 Screenshot 2020-02-13 14 44 38 Screenshot 2020-02-13 14 46 53

2. Add Mixpanel as a dependency

Add the following to the end of your Podfile:

target 'NotificationService' do
  use_frameworks!
  
  pod 'Mixpanel'
end

Then run pod install

3. Extend your NotificationService from MixpanelNotificationServiceExtension

Replace the contents of your NotificationService.h file with the following:

@import Mixpanel;

@interface NotificationService : MPNotificationServiceExtension

@end

Replace the contents of your NotificationService.m file with the following:

#import "NotificationService.h"

@implementation NotificationService

@end

4. Delegate the handling of the notification response to the Mixpanel SDK

In your AppDelegate.m file:

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void (^)(void))completionHandler
{
    if ([Mixpanel isMixpanelPushNotification:response.notification.request.content]) {
        NSLog(@"%@ delegating to Mixpanel SDK handler to handle push notification response...", self);
        [Mixpanel userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
    } else {
        NSLog(@"%@ Not a Mixpanel push notification....", self);
        completionHandler();
    }
}

This will make sure the tap actions are appropriately handled (open url, deeplink, etc) as well as track whether a notification was tapped or dismissed.

5. Run the app and send a test push notification from Mixpanel that includes an image or buttons

That's it! Your app should now be able to receive rich push notifications from Mixpanel.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].