Skip to main content

iOS (Swift)

Integrate the library

The first step to use our SDK is to integrate our library in your project. You have multiple ways to do this.

SPM (Swift Package Manager)

Add our SDK's Github repository as an external dependency:

https://github.com/at-internet/piano-analytics-apple

Carthage

Add our SDK's Github repository as an external dependency in your Cartfile:

github "at-internet/piano-analytics-apple" ~> 3.0

Cocoapods

Add our SDK's Cocoapods podname as an external dependency in your Podfile:

pod "PianoAnalytics/iOS", ">=3.0"

Configuration

In order to setup your tracking, you need to set the configuration of the library:

pa.setConfiguration(_ config: Configuration);

Here is the minimal configuration required:

pa.setConfiguration(ConfigurationBuilder()
.withCollectDomain("<xxxxxxx>.pa-cd.com")
.withSite(123456789)
.build()
)
note

Don't hesitate to read our collection methods article to find the collection domain that has been assigned to you.

You can also use a custom domain thanks to our CDDC.

Here are the available configurations:

CategoryNameConfigurationBuilder functionDescriptionTypeValueMore info
GlobalcollectDomainwithCollectDomainCollection domainstring<xxxxxxx>.pa-cd.comView
GlobalsitewithSiteSite idint123456789View
GlobalpathwithPathRequest pathstringevent
GlobalcustomUserAgentwithCustomUserAgentCustom user agentstringMy User Agent
GlobalcrashDetectionenableCrashDetectionEnable (true) or not (false) automatic crash detectionbooleantrue (default), false
GlobalsessionBackgroundDurationwithSessionBackgroundDurationBackgound delay before considering a session as over (seconds)int30
PrivacyignoreLimitedAdvertisingTrackingenableIgnoreLimitedAdvertisingTrackingWhether the SDK should ignore (true) or not (false) the end-user choice to limit ad tracking.booleantrue, false (default)
PrivacysendEventWhenOptoutenableSendEventWhenOptoutDo you want to send events when optout?booleantrue (default), false
PrivacyprivacyDefaultModewithPrivacyDefaultModePrivacy mode by defaultstringoptin (default)View
StorageofflineEncryptionModewithOfflineEncryptionModeOffline feature encryption mode.stringnone, ifCompatible (default), force
StorageofflineStorageModewithOfflineStorageModeOffline feature storage mode. always will always store data, you need to send data yourself required automatically manage offline storage depending on network conditions, never will never store datastringalways, required (default), never
StorageofflineSendIntervalwithOfflineSendIntervalOffline feature interval between sent requestsint500
StoragestorageLifetimePrivacywithStorageLifetimePrivacyLifetime Storage Privacy valueint395 (days)View
StoragestorageLifetimeUserwithStorageLifetimeUserLifetime Storage User valueint395 (days)View
StoragestorageLifetimeVisitorwithStorageLifetimeVisitorLifetime Storage Visitor valueint395 (days)View
StoragevisitorStorageModewithVisitorStorageModeRelative or fixed cookie lifetime value for visitorstringfixed (default), relative
Visitor PolicyvisitorIdTypewithVisitorIdTypeVisitor ID typestringuuid (default), idfa, idfv, custom
Visitor PolicyvisitorIdwithVisitorIDCustom visitor IDstring39001HUFEKK977894

Changelog

You can find the iOS changelog directly on GitHub.

info

If you want to stay updated with our SDK releases, please subscribe to it on Github directly:

subscribe to Github releases

Apple Privacy Manifest

Apple is emphasizing transparency and user privacy on the App Store by guiding developers on how to describe data usage and permissions required in their apps.

Developers must detail data usage in their privacy manifests, including data managed by third-party SDKs, to inform users about data collection and usage.

Developers are guided on the use of the Required Reason API to justify requested permissions, improving users' understanding of the need for certain data or functionality.

As provided our DPA:

"The processor shall refrain from any use of the data other than that strictly necessary to provide the solution to the controller".

Article 8 of our DPA - Purpose limitation

That's why we've provided you with a sample table to meet Apple's needs, to be completed as required.

Data usage

Data typeValueNSPrivacyCollectedDataTypeLinkedNSPrivacyCollectedDataTypeTrackingNSPrivacyCollectedDataTypePurposes
Device IDNSPrivacyCollectedDataTypeProductInteractionTrueTrueNSPrivacyCollectedDataTypePurposeAnalytics
Other usage dataNSPrivacyCollectedDataTypeOtherUsageDataTrueTrueNSPrivacyCollectedDataTypePurposeAnalytics
Crash data (optional)NSPrivacyCollectedDataTypeCrashDataTrueTrueNSPrivacyCollectedDataTypePurposeAnalytics
User ID (optional)NSPrivacyCollectedDataTypeUserIDTrueTrueNSPrivacyCollectedDataTypePurposeAnalytics
Other data types (optional)NSPrivacyCollectedDataTypeOtherDataTypesTrueTrueNSPrivacyCollectedDataTypePurposeAnalytics
note

Optional data types depend on your implementation.

API

APINSPrivacyAccessedAPITypeNSPrivacyAccessedAPITypeReasons
UserDefaultsNSPrivacyAccessedAPICategoryUserDefaultsCA92.1