iOS (Swift)
Before I start
Piano Analytics SDKs have been designed for the Piano Analytics solution. Data sent through these SDKs will not be processed within the Analytics Suite 2.
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("logsx.xiti.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 |
---|---|---|---|---|---|
Global | collectDomain | withCollectDomain | Collection domain | string | logsx.xiti.com |
Global | site | withSite | Site id | int | 123456789 |
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) |
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) |
Storage | storageLifetimeUser | withStorageLifetimeUser | Lifetime Storage User value | int | 395 (days) |
Storage | storageLifetimeVisitor | withStorageLifetimeVisitor | Lifetime Storage Visitor value | int | 395 (days) |
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.