README.md

March 12, 2026 ยท View on GitHub

Codacy Badge

Countly iOS SDK Sample Application

Sample iOS, iOS-Swift, watchOS, tvOS, and macOS projects demonstrating how to use the Countly iOS SDK.

What is Countly?

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.

Requirements

  • iOS 15.0+
  • Xcode 15+

Getting Started

The Countly iOS SDK is included as a git submodule. After cloning this repository, run:

git submodule update --init

Running the iOS Sample App

  1. Open ios/CountlyTestApp-iOS.xcodeproj in Xcode.

  2. Update your Countly server URL and app key in AppDelegate.m:

    config.appKey = @"YOUR_APP_KEY";
    config.host = @"https://YOUR_COUNTLY_SERVER";
    
  3. Update the Bundle ID and code signing to match your developer account.

  4. Build and run on a simulator or device.

iOS App Structure

The iOS sample app is organized into grouped sections, each covering a specific area of the SDK:

Data & Events

SectionDescription
Custom EventsRecord events with keys, segmentation, count, sum, and duration
Remote ConfigFetch, list, and manage remote config values and A/B experiments
Content BuilderEnter/exit/refresh content zones, change device ID

User & Analytics

SectionDescription
User DetailsSet standard and custom user properties
View TrackingStart/stop views, automatic view tracking, view actions
AttributionRecord direct and indirect attribution

Stability & Performance

SectionDescription
Crash ReportingGenerate test crashes, record handled exceptions, crash breadcrumbs
APMCustom network traces, app performance monitoring

Engagement

SectionDescription
Push NotificationsRequest permission, send test push tokens
FeedbackNPS, surveys, star ratings, feedback widgets
LocationSet GPS coordinates and IP-based location

SDK Management

SectionDescription
ConsentsGrant/revoke individual or all feature consents
Queue OperationsFlush queues, manage app keys, direct requests
SDK LifecycleChange device ID, host, app key; halt SDK; session management
MultithreadingStress-test SDK thread safety

Other Platforms

PlatformProject Path
iOS (Swift)ios-swift/
macOSmacos/
tvOStvos/
watchOSwatchos/

Push Notification Setup

  1. Create your push notification certificate and upload it to your Countly server.
  2. Enable push notifications in your config:
    • Objective-C: config.features = @[CLYPushNotifications];
    • Swift: config.features = @[CLYFeature.pushNotifications];
  3. Run the app, choose "Ask for Notification Permission", and confirm.
  4. The push token is automatically sent to the Countly server.

Security

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.

Badges

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?

Countly - Product Analytics

<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>

Countly - Product Analytics

<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>

How can I help you with your efforts?

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.