Skip to main content

Get Started

codecov

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

The PAPulse SDK is written entirely in Swift. However, the public API calls are fully compatible with Objective-C code.

How To Install

Cocoapods

CocoaPods is indeed a dependency manager for iOS projects. To install CocoaPods, you can use the following command in the Terminal:

$ sudo gem install cocoapods

The PAPulse SDK functionality is distributed across several CocoaPods subspecs (modules), enabling flexible configuration. You have the freedom to include only the specific modules that are required for your application. This approach helps to reduce integration and build time, as well as the final size of the binary application. Depending on your needs and local laws, you can integrate the Analytics SDK either with or without the AppTrackingTransparency (ATT) framework, which is responsible for providing the IDFA value.

Option #1: Analytics SDK with ATT (default configuration)

Pod name (CocoaPods spec\subspec)Description
pulse-iosDefault configuration, the same as pulse-ios/Analytics.
It contains all the necessary features for efficient application development, including Events Tracking, Remote Settings, A/B Experiments, UI Auto-Events, and Revenue Tracking for Objective-C and Swift code
pulse-ios/SwiftUIAdvanced configuration as pulse-ios/Analytics + SwiftUI support
pulse-ios/ExtensionAnalyticsLightweight configuration for App Extension targets only

Option #2: Analytics SDK without ATT

Pod name (CocoaPods spec\subspec)Description
pulse-ios/AnalyticsNoATTAnalytics SDK configuration, the same as pulse-ios/Analytics but without ATT.
It contains all the necessary features for efficient application development, including Events Tracking, Remote Settings, A/B Experiments, UI Auto-Events, and Revenue Tracking for Objective-C and Swift code
pulse-ios/SwiftUINoATTAdvanced configuration as pulse-ios/AnalyticsNoATT + SwiftUI support
pulse-ios/ExtensionAnalyticsNoATTLightweight configuration without ATT for App Extension targets only

Since PAPulse is a closed proprietary library and not available on CocoaPods for public access, you won't be able to integrate it directly through CocoaPods. Instead, you can manually integrate PAPulse into your Xcode project by specifying the podspec URL and the desired version from the Picsart GitLab repository in your Podfile:

pod "pulse-ios", :git => 'https://gitlab.com/picsart/di/sdk/pulse-ios', :tag => 'v.2.18.0'

To install the PAPulse module for the App Extensions in your Xcode project, add the following line to the appropriate project target's dependencies section in your Podfile:

pod "pulse-ios/ExtensionAnalytics", :git => 'https://gitlab.com/picsart/di/sdk/pulse-ios', :tag => 'v.2.18.0'
Keep in mind

PAPulse version 2.18.0 is required. To obtain the desired available version, you should only modify the parameter to :tag => 'v.2.18.0' (please refer to the CHANGELOG.md file to select the appropriate version).

Save the Podfile.

Run the command in the Terminal to fetch and integrate PAPulse into your Xcode project.

$ pod install

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) with, then use initializer variant with two arguments:

PAAnalytics.configSet(appName: "com.yourappname.studio", groupName: "extension_name")

Ideally, this method should be your first invocation of Pulse Analytics SDK. Otherwise, you should call the public method PAAnalytics.migrateIfNeeded(for:) before further calls of Pulse Analytics SDK functions or getting properties, which are placed before aforementioned PAAnalytics.configSet(appName:groupName:) or PAAnalytics.configSet(appName:groupName:).

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