Skip to content

at-internet/piano-analytics-apple

Repository files navigation


Piano Analytics SDK Apple

About The Project

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.

Getting Started

  • 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

Using Cocoapods

If you are new to Cocoapods, please refer to CocoaPods documentation

  1. 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
  2. Save your Podfile

  3. Run pod install

(back to top)

Using Swift Package Manager

  1. In your application click File > Add Packages...

  2. Paste the url of the public repository in the search box on the top right https://github.com/at-internet/piano-analytics-apple

  3. Select piano-analytics-apple package

  4. Click Add Package

(back to top)

Using Carthage

  1. Update the Cartfile with the following line:

    github "at-internet/piano-analytics-apple" ~> 3.1
  2. Save your Cartfile

  3. Run carthage update --platform iOS with the according platform (you may need to use the --use-xcframeworks option in case of failure)

  4. Add the dependency from Build/PianoAnalytics.xcframework in "Frameworks, Libraries, and Embedded Content"

(back to top)

Usage

  1. Configure your site and collect domain in your application initialization

    import PianoAnalytics
    
    ...
    
    pa.setConfiguration(ConfigurationBuilder()
        .withCollectDomain("log.xiti.com")
        .withSite(123456789)
        .build()
    )
  2. 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

(back to top)

Contributing

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

License

Distributed under the MIT License.

(back to top)

Contact

AtInternet a Piano Company - [email protected]

(back to top)