Sample iOS, iOS-Swift, watchOS, tvOS, and macOS projects demonstrating how to use the Countly iOS SDK.
Countly is a product analytics solution and innovation enabler that helps teams track product performance and customer journey and behavior across mobile, web, and desktop applications. Ensuring privacy by design, Countly allows you to innovate and enhance your products to provide personalized and customized customer experiences, and meet key business and revenue goals.
Track, measure, and take action - all without leaving Countly.
- Questions or feature requests? Join the Countly Community on Discord
- Looking for the Countly Server? Countly Community Edition repository
- Looking for other Countly SDKs? An overview of all Countly SDKs for mobile, web and desktop
- iOS 15.0+
- Xcode 15+
The Countly iOS SDK is included as a git submodule. After cloning this repository, run:
git submodule update --init-
Open
ios/CountlyTestApp-iOS.xcodeprojin Xcode. -
Update your Countly server URL and app key in
AppDelegate.m:config.appKey = @"YOUR_APP_KEY"; config.host = @"https://YOUR_COUNTLY_SERVER";
-
Update the Bundle ID and code signing to match your developer account.
-
Build and run on a simulator or device.
The iOS sample app is organized into grouped sections, each covering a specific area of the SDK:
| Section | Description |
|---|---|
| Custom Events | Record events with keys, segmentation, count, sum, and duration |
| Remote Config | Fetch, list, and manage remote config values and A/B experiments |
| Content Builder | Enter/exit/refresh content zones, change device ID |
| Section | Description |
|---|---|
| User Details | Set standard and custom user properties |
| View Tracking | Start/stop views, automatic view tracking, view actions |
| Attribution | Record direct and indirect attribution |
| Section | Description |
|---|---|
| Crash Reporting | Generate test crashes, record handled exceptions, crash breadcrumbs |
| APM | Custom network traces, app performance monitoring |
| Section | Description |
|---|---|
| Push Notifications | Request permission, send test push tokens |
| Feedback | NPS, surveys, star ratings, feedback widgets |
| Location | Set GPS coordinates and IP-based location |
| Section | Description |
|---|---|
| Consents | Grant/revoke individual or all feature consents |
| Queue Operations | Flush queues, manage app keys, direct requests |
| SDK Lifecycle | Change device ID, host, app key; halt SDK; session management |
| Multithreading | Stress-test SDK thread safety |
| Platform | Project Path |
|---|---|
| iOS (Swift) | ios-swift/ |
| macOS | macos/ |
| tvOS | tvos/ |
| watchOS | watchos/ |
- Create your push notification certificate and upload it to your Countly server.
- Enable push notifications in your config:
- Objective-C:
config.features = @[CLYPushNotifications]; - Swift:
config.features = @[CLYFeature.pushNotifications];
- Objective-C:
- Run the app, choose "Ask for Notification Permission", and confirm.
- The push token is automatically sent to the Countly server.
Security is very important to us. If you discover any issue regarding security, please disclose the information responsibly by sending an email to security@count.ly and not by creating a GitHub issue.
If you like Countly, why not use one of our badges and give a link back to us so others know about this wonderful platform?
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/dark.svg" alt="Countly - Product Analytics" /></a><a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/light.svg" alt="Countly - Product Analytics" /></a>Glad you asked! For community support, feature requests, and engaging with the Countly Community, please join us at our Discord Server. We're excited to have you there!
Also, we are on Twitter and LinkedIn if you would like to keep up with Countly related updates.