SRGSSR / srganalytics-apple

Covers analytics needs for SRG SSR products.
MIT License
0 stars 1 forks source link
apple

SRG Analytics logo

GitHub releases platform SPM compatible GitHub license

[!IMPORTANT] Letterbox will be sunset in August 2025, replaced by Pillarbox. SRG Analytics will be decommissioned as well, replaced by an equivalent Analytics package available from Pillarbox:

  • New SRG SSR products must use Pillarbox Analytics only.
  • Existing SRG SSR products using SRG Analytics must transition to Pillarbox Analytics before this date.

About

The SRG Analytics library makes it easy to add usage tracking information to your iOS and tvOS applications, following the SRG SSR standards.

Measurements are based on events emitted by the application and sent to Commanders Act (for internal analytics purposes) as well as Mediapulse (for official audience measurements, via comScore).

The SRG Analytics library supports three kinds of measurements:

Compatibility

The library is suitable for applications running on iOS 12, tvOS 12 and above. The project is meant to be compiled with the latest Xcode version.

Contributing

If you want to contribute to the project, have a look at our contributing guide.

Integration

The library must be integrated using Swift Package Manager directly within Xcode. You can also declare the library as a dependency of another one directly in the associated Package.swift manifest.

Libraries

The library is made of serveral smaller libraries. Which ones your project must link against depends on your needs:

Info.plist settings for application installation measurements

The library automatically tracks which SRG SSR applications are installed on a user device, and sends this information. For this mechanism to work properly, though, your application must declare all official SRG SSR application URL schemes as being supported in its Info.plist file.

This can be achieved as follows:

If URL schemes declared by your application do not match the current ones, application installations will not be accurately reported, and error messages will be logged when the application starts (see Logging below). This situation is not catastropic but should be fixed when possible to ensure better measurements.

Remark

The number of URL schemes an application declares is limited to 50. Please contact us if your application reaches this limit.

Usage

When you want to use classes or functions provided by one of the librares in your code, you must import it from your source files first. In Objective-C:

@import SRGAnalytics;
@import SRGAnalyticsMediaPlayer;
@import SRGAnalyticsDataProvider;
@import SRGAnalyticsIdentity;

or in Swift:

import SRGAnalytics
import SRGAnalyticsSwiftUI
import SRGAnalyticsMediaPlayer
import SRGAnalyticsDataProvider
import SRGAnalyticsIdentity

Working with the library

To learn about how the library can be used, have a look at the getting started guide.

Logging

The library internally uses the SRG Logger library for logging, with the following subsystems:

This logger either automatically integrates with your own logger, or can be easily integrated with it. Refer to the SRG Logger documentation for more information.

App Privacy details on the App Store

You are required to provide additional information about the data collected by your app and how it is used. Please refer to our associated documentation for more information.

Demo project

To test what the library is capable of, run the associated demo.

License

See the LICENSE file for more information.