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()
)
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:
Category | Name | ConfigurationBuilder function | Description | Type | Value | More info |
---|---|---|---|---|---|---|
Global | collectDomain | withCollectDomain | Collection domain | string | <xxxxxxx>.pa-cd.com | View |
Global | site | withSite | Site id | int | 123456789 | View |
Global | path | withPath | Request path | string | event | |
Global | customUserAgent | withCustomUserAgent | Custom user agent | string | My User Agent | |
Global | crashDetection | enableCrashDetection | Enable (true ) or not (false ) automatic crash detection | boolean | true (default), false | |
Global | sessionBackgroundDuration | withSessionBackgroundDuration | Backgound delay before considering a session as over (seconds) | int | 30 | |
Privacy | ignoreLimitedAdvertisingTracking | enableIgnoreLimitedAdvertisingTracking | Whether the SDK should ignore (true ) or not (false ) the end-user choice to limit ad tracking. | boolean | true , false (default) | |
Privacy | sendEventWhenOptout | enableSendEventWhenOptout | Do you want to send events when optout? | boolean | true (default), false | |
Privacy | privacyDefaultMode | withPrivacyDefaultMode | Privacy mode by default | string | optin (default) | View |
Storage | offlineEncryptionMode | withOfflineEncryptionMode | Offline feature encryption mode. | string | none , ifCompatible (default), force | |
Storage | offlineStorageMode | withOfflineStorageMode | Offline 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 data | string | always , required (default), never | |
Storage | offlineSendInterval | withOfflineSendInterval | Offline feature interval between sent requests | int | 500 | |
Storage | storageLifetimePrivacy | withStorageLifetimePrivacy | Lifetime Storage Privacy value | int | 395 (days) | View |
Storage | storageLifetimeUser | withStorageLifetimeUser | Lifetime Storage User value | int | 395 (days) | View |
Storage | storageLifetimeVisitor | withStorageLifetimeVisitor | Lifetime Storage Visitor value | int | 395 (days) | View |
Storage | visitorStorageMode | withVisitorStorageMode | Relative or fixed cookie lifetime value for visitor | string | fixed (default), relative | |
Visitor Policy | visitorIdType | withVisitorIdType | Visitor ID type | string | uuid (default), idfa , idfv , custom | |
Visitor Policy | visitorId | withVisitorID | Custom visitor ID | string | 39001HUFEKK977894 |
Changelog
You can find the iOS changelog directly on GitHub.
If you want to stay updated with our SDK releases, please subscribe to it on Github directly:
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 type | Value | NSPrivacyCollectedDataTypeLinked | NSPrivacyCollectedDataTypeTracking | NSPrivacyCollectedDataTypePurposes |
---|---|---|---|---|
Device ID | NSPrivacyCollectedDataTypeProductInteraction | True | True | NSPrivacyCollectedDataTypePurposeAnalytics |
Other usage data | NSPrivacyCollectedDataTypeOtherUsageData | True | True | NSPrivacyCollectedDataTypePurposeAnalytics |
Crash data (optional) | NSPrivacyCollectedDataTypeCrashData | True | True | NSPrivacyCollectedDataTypePurposeAnalytics |
User ID (optional) | NSPrivacyCollectedDataTypeUserID | True | True | NSPrivacyCollectedDataTypePurposeAnalytics |
Other data types (optional) | NSPrivacyCollectedDataTypeOtherDataTypes | True | True | NSPrivacyCollectedDataTypePurposeAnalytics |
Optional data types depend on your implementation.
API
API | NSPrivacyAccessedAPIType | NSPrivacyAccessedAPITypeReasons |
---|---|---|
UserDefaults | NSPrivacyAccessedAPICategoryUserDefaults | CA92.1 |