The Piano Analytics Apple SDK allows you to collect audience measurement data for the Piano Analytics solution. It can be used with iOS, watchOS, tvOS and iOS extension applications.
This SDK makes the implementation of Piano Analytics as simple as possible, while keeping all the flexibility of the solution. By using this small library in your applications, and using dedicated and documented methods, you will be able to send powerful events.
It also includes Privacy tagging methods that allow you a perfect management of your tagging depending on the regulation you refer to.
- Install our library on your project (see below), you have a few possibilities :
- Using NPM
- Using our CDN (browser only)
- Cloning the GitHub project to build a file you will host (browser only)
- You can use this method if you want to configure your library without additional tagging (ex: like having your site and collect domain already configured in the built file). However, we suggest the NPM method if you use Build Tools (webpack etc.)
- Check the documentation for an overview of the functionalities and code examples
If you are new to Cocoapods, please refer to CocoaPods documentation
-
Update your Podfile with the according line(s)
# iOS Application pod "PianoAnalytics/iOS", ">=3.1" # tvOS Application pod "PianoAnalytics/tvOS", ">=3.1" # watchOS Application pod "PianoAnalytics/watchOS", ">=3.1" # iOS Application pod "PianoAnalytics/appExtension", ">=3.1"
To avoid conflicts caused by CocoaPods, it's possible to use an independent pod:
target 'MyProject' do pod "PianoAnalytics-AppExtension", ">=3.1" use_frameworks! end
If you do not have any other pods, your Podfile should look something like:
target 'MyProject' do pod "PianoAnalytics/iOS", ">=3.1" use_frameworks! end
-
Save your Podfile
-
Run
pod install
-
In your application click File > Add Packages...
-
Paste the url of the public repository in the search box on the top right
https://github.com/at-internet/piano-analytics-apple
-
Select piano-analytics-apple package
-
Click Add Package
-
Update the Cartfile with the following line:
github "at-internet/piano-analytics-apple" ~> 3.1
-
Save your Cartfile
-
Run
carthage update --platform iOS
with the according platform (you may need to use the--use-xcframeworks
option in case of failure) -
Add the dependency from Build/PianoAnalytics.xcframework in "Frameworks, Libraries, and Embedded Content"
-
Configure your site and collect domain in your application initialization
import PianoAnalytics ... pa.setConfiguration(ConfigurationBuilder() .withCollectDomain("log.xiti.com") .withSite(123456789) .build() )
-
Send events
pa.sendEvent(Event("page.display", data: [ "page": "page name", // Event properties "page_chapter1": "chapter 1", "page_chapter2": "chapter 2", "page_chapter3": "chapter 3" ]))
or
pa.sendEvent(Event(PA.EventName.Page.Display, properties: Set([ try! Property(PA.PropertyName.Page.Page, "name"), try! Property(PA.PropertyName.Page.Duration, true), try! Property(PA.PropertyName.Page.Position, "1", forceType: .int) ])))
For more examples, please refer to the Documentation
Please do not hesitate to contribute by using this github project, we will look at any merge request or issue. Note that we will always close merge request when accepting (or refusing) it as any modification has to be done from our side exclusively (so we will be the ones to implement your merge request if we consider it useful). Also, it is possible that issues and requests from GitHub may take longer for us to process as we have dedicated support tools for our customers. So we suggest that you use GitHub tools for technical purposes only :)
Distributed under the MIT License.
AtInternet a Piano Company - [email protected]