mixpanel/mixpanel-iphone
mixpanel/mixpanel-iphone has 1,066 GitHub stars and 566 forks. GitHot measured -1 in 7 days and -1 in 15 days. Last checked 2026-11-09 08:28 UTC. Last push 2026-07-21.
Official iOS (Objective-C) Tracking Library for Mixpanel Analytics
측정된 스타 증가
- in 24h
- 업데이트 지연
- in 7 days
- -1
- in 15 days
- -1
- in 1 month
- 업데이트 지연
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalTable of Contents
Overview
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.
Check out our Advanced iOS - Objective-C Guide for additional advanced configurations and use cases, like setting up your project with European Union data storage.
Skip to a complete code example.
Quick Start Guide
Caution: From v4.0.0.beta.3 to v4.1.0, we have a bug that events with ampersand(&) will be rejected by the server. We recommend you update to v4.1.1 or above.
1. Install Mixpanel
You can install the Mixpanel iOS - Objective-C library by using CocoaPods or Carthage. You will need your project token for initializing your library. You can get your project token from project settings.
Installation Option 1: CocoaPods
- If this is your first time using CocoaPods, Install CocoaPods using
gem install cocoapods. Otherwise, continue to Step 3. - Run
pod setupto create a local CocoaPods spec mirror. - Create a Podfile in your Xcode project directory by running
pod initin your terminal, edit the Podfile generated, and add the following line:pod 'Mixpanel'. - Run
pod installin your Xcode project directory. CocoaPods should download and install the Mixpanel library, and create a new Xcode workspace. Open up this workspace in Xcode or typingopen *.xcworkspacein your terminal.
Installation Option 2: Carthage
Mixpanel supports Carthage to package your dependencies as a framework. Include the following dependency in your Cartfile:
github "mixpanel/mixpanel-iphone"
Check out the Carthage docs for more info.
Installation Option 3: Swift Package Manager
- In Xcode, select File > Add Packages...
- Enter the package URL for this repository and must select a version greater than or equal to v4.0.0
2. Initialize Mixpanel
To initialize the library, add `#Import "Mixpanel/Mixpanel.h" into "AppDelegate.m" and call sharedInstanceWithToken: with your project token as its argument in application:didFinishLaunchingWithOptions:.
#import "Mixpanel/Mixpanel.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
[Mixpanel sharedInstanceWithToken:@"YOUR_API_TOKEN" trackAutomaticEvents:NO];
...
}
3. Send Data
Let's get started by sending event data. You can send an event from anywhere in your application. Better understand user behavior by storing details that are specific to the event (properties). After initializing the library, Mixpanel will automatically collect common mobile events. You can enable/disable automatic collection through your project settings. Also, Mixpanel automatically tracks some properties by default. learn more
Mixpanel *mixpanel = [Mixpanel sharedInstance];
[mixpanel track:@"Sign Up" properties:@{
@"source": @"Pat's affiliate site",
@"Opted out of email": @YES
}];
4. Check for Success
Open up Events in Mixpanel to view incoming events.
Once data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your project.
Complete Code Example
Here's a runnable code example that covers everything in this quickstart guide.
#import "Mixpanel/Mixpanel.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:@"YOUR_API_TOKEN" trackAutomaticEvents:NO];
[mixpanel track:@"Sign Up" properties:@{
@"source": @"Pat's affiliate site",
@"Opted out of email": @YES
}];
...
}
FAQ
I want to stop tracking an event/event property in Mixpanel. Is that possible?
Yes, in Lexicon, you can intercept and drop incoming events or properties. Mixpanel won’t store any new data for the event or property you select to drop. See this article for more information.
I have a test user I would like to opt out of tracking. How do I do that?
Mixpanel’s client-side tracking library contains the optOutTracking() method, which will set the user’s local opt-out state to “true” and will prevent data from being sent from a user’s device. More detailed instructions can be found in the section, Opting users out of tracking.
Why aren't my events showing up?
To preserve battery life and customer bandwidth, the Mixpanel library doesn't send the events you record immediately. Instead, it sends batches to the Mixpanel servers every 60 seconds while your application is running, as well as when the application transitions to the background. You can call flush() manually if you want to force a flush at a particular moment.
[mixpanel flush];
If your events are still not showing up after 60 seconds, check if you have opted out of tracking. You can also enable Mixpanel debugging and logging, it allows you to see the debug output from the Mixpanel library. To enable it, set enableLogging to true.
mixpanel.enableLogging = YES;
Starting with iOS 14.5, do I need to request the user’s permission through the AppTrackingTransparency framework to use Mixpanel?
No, Mixpanel does not use IDFA so it does not require user permission through the AppTrackingTransparency(ATT) framework.
If I use Mixpanel, how do I answer app privacy questions for the App Store?
Please refer to our Apple App Developer Privacy Guidance
I want to know more!
No worries, here are some links that you will find useful:
Have any questions? Reach out to Mixpanel Support to speak to someone smart, quickly.
관련 프로젝트 살펴보기
Asabeneh/30-Days-Of-Python
30 Days of Python 프로그래밍 챌린지는 Python 프로그래밍 언어를 30일 동안 배우기 위한 단계별 가이드입니다. 이 챌린지는 100일 이상 걸릴 수 있습니다. 자신의 속도에 맞춰 진행하세요. 다음 동영상도 도움이 될 수 있습니다: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,486 스타grafana/grafana
개방적이고 조합 가능한 옵저버빌리티 및 데이터 시각화 플랫폼입니다. Prometheus, Loki, Elasticsearch, InfluxDB, Postgres 등 여러 소스의 메트릭, 로그, 트레이스를 시각화합니다.
77,790 스타redis/redis
실시간 데이터 기반 애플리케이션을 구축하는 개발자에게 Redis는 가장 선호되고, 가장 빠르며, 기능이 가장 풍부한 캐시, 데이터 구조 서버이자 문서 및 벡터 쿼리 엔진입니다.
77,332 스타apache/superset
Apache Superset는 데이터 시각화 및 데이터 탐색 플랫폼입니다.
75,455 스타