Get Started
The iOS PAPulse Analytics Framework is a private library that offers numerous features, including:
- Collection, storage, and transmission of predefined app-, user-, and network metrics-related information for subsequent analysis and report generation on the backend side
- A\B experiments management
- Remote Settings management
- Revenue tracking (not included in the Swift Package Manager distribution; requires a build that links
PAPulseRevenueTracking)
The PAPulse SDK is written entirely in Swift. Most public API calls are exposed to Objective-C; a few Swift-only APIs (async settings getters, attProvider, SwiftUI modifiers) are marked @nonobjc.
How To Install
PAPulse Analytics SDK is compatible with iOS 15.0 and above.
Swift Package Manager
Swift Package Manager is a tool for managing the distribution of Swift code. It's integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
Due to PAPulse being a closed proprietary library, it is not available in the public Swift Package Registry. To integrate PAPulse into your Xcode project using Swift Package Manager, you need to add the package from the private Picsart GitLab repository.
Package Information: This package provides PAPulse SDK without ATT support for maximum compatibility across all regions.
Adding via Xcode:
- In Xcode, go to File → Add Package Dependencies...
- Enter the repository URL:
https://gitlab.com/picsart/di/sdk/pulse-ios.git - Select the version (e.g., tag
3.19.4)
Adding via Package.swift:
dependencies: [
.package(url: "https://gitlab.com/picsart/di/sdk/pulse-ios.git", from: "3.19.4")
],
targets: [
.target(
name: "YourTarget",
dependencies: [
.product(name: "PAPulse", package: "pulse-ios")
]
)
]
Available Products
| Product name | Description |
|---|---|
| PAPulse | Main analytics functionality including Session Replay (NoATT) |
| PAPulseSwiftUI | SwiftUI support (NoATT) |
| PAPulseAppExtension | Framework for app extensions (NoATT) |
PAPulse version 3.19.4 or later is required. You should change the version parameter to obtain the desired available version (see CHANGELOG.md).
How To Get Started
Basics
The SDK has a singleton instance that it manages by itself, and that instance lives as long as the app lives. You don't need to worry about retaining the SDK anywhere. You communicate with the SDK with help of static methods of PAAnalytics.
So for example:
PAAnalytics.disableDebugMode()
PAAnalytics module for a regular iOS application
First you need to setup the SDK in order for it to work properly. We suggest doing so in application:didFinishLaunchingWithOptions:.
You need supply your application bundle identifier to the SDK:
PAAnalytics.configSet(appName: "com.yourappname.studio")
If you have an app extension that you'd like to share the data (like userID, segments, experiments, language code, PII permissions) with, then use initializer variant with two arguments:
PAAnalytics.configSet(appName: "com.yourappname.studio", groupName: "group.com.yourappname.studio")
configSet(appName:) / configSet(appName:groupName:) must be the first Pulse Analytics SDK call you make. appName also namespaces the SDK's storage inside the shared app-group container, so every other SDK call and property read depends on it being set first. There is no public API to repair the state afterwards.
Call start to start session, logging and sending info to server.
PAAnalytics.start()
PAExtensionAnalytics module for regular iOS app extension
The first argument is app group that is used for creating shared defaults and pass the data between main app and extension. The second argument is your host application bundle identifier. The third argument is the app extension's desired name that helps identify and analyze fired events sequence in the web dashboard.
PAExtensionAnalytics.configSet(groupName: "group_name", appName: "com.yourappname.studio", extensionName: "extension_name")
The PAExtensionAnalytics module exposes a deliberately small surface — it shares the host app's configuration through the app group instead of re-declaring it:
// Optional configuration
PAExtensionAnalytics.configSet(debugModeEnabled: true)
PAExtensionAnalytics.configSet(debugConsoleLogging: .system)
// Tracking
PAExtensionAnalytics.logEvent("extension-opened")
PAExtensionAnalytics.logEvent("extension-action", data: ["source": "share-sheet"])
PAExtensionAnalytics.logPushNotificationReceived(userInfo: userInfo)
// A/B experiments (shared with the host app through the app group)
PAExtensionAnalytics.runTest(
"experiment-name",
original: { showClassicLayout() },
experiments: ["variant_a": { showNewLayout() } as AnyObject]
)
let variant = PAExtensionAnalytics.experimentVariant(for: "experiment-name")
Events logged before the extension finishes configuring itself are postponed (up to 10 of them) and flushed once configuration completes. To be notified when the extension has finished sending its batch, observe PAExtensionAnalytics.ExtensionSenderHasFinishedNotification.