Skip to content

User consent

Pierre-Yves B edited this page Aug 30, 2023 · 6 revisions

User consent

As of September 2023 Swiss data privacy laws require apps to ask the user about their consent when gathering analytics data.

The third-party SDK SRG SSR apps must integrate to manage user consent is Usercentrics. Though SRG Analytics currently does not provide any transparent integration with Usercentrics, it is easy to extract user consent settings from Usercentrics and to provide them to SRG Analytics.

Tracker setup

Sending user consent requires additional labels to be provided in each event sent by the SRG Analytics SDK. This can be achieved as follows:

  1. Create a type conforming to the SRGAnalyticsTrackerDataSource or use an existing one (e.g. your application delegate directly).
  2. Implement its required method to return global labels to be sent with each comScore or Tag Commander event.
  3. Provide an instance of this data source when starting the tracker. The tracker only keeps a weak reference to its data source which must be retained somewhere else.

You can provide user consent information in labels returned from SRGAnalyticsTrackerDataSource.

Sending user consent to comScore

You must send a cs_ucfr label with the following possible values:

Value Meaning
0 User has not given consent or has opted out
1 User has given consent
Empty string The user has not taken an action

Further official Mediapulse / comScore documentation is available from our private Confluence wiki.

Sending user consent to Tag Commander

Tag Commander is only a tag management tool which is able to forward the data it receives to other services the user is free to accept or refuse. For this reason you must send a consent_services string to Tag Commander, containing the Usercentrics service identifiers for which the user has provided consent, separated by a comma.

For example, if the user has given consent for services service1, service2, service4 but not service3, you must send service1,service2,service4 in consent_services.

Then for DPOs, on TagCommander server v1 (and mobile SDK v4), we recommend to follow the Tag Commander documentation with this consent_services variable.

Sample implementation

Here is a sample implementatioon of the SRGAnalyticsTrackerDataSource protocol:

- (SRGAnalyticsLabels *)srg_globalLabels
{
    SRGAnalyticsLabels *labels = [[SRGAnalyticsLabels alloc] init];
    labels.comScoreCustomInfo = @{
        @"cs_ucfr": @"1"
    };
    labels.customInfo = @{
        @"consent_services": @"service1,service2,service4"
    };
    
    // Add other global labels here.
    
    return labels;
}

Values reflecting the actual user consent must be retrieved from the Usercentrics SDK integrated in your application.