Privacy

  • iOS
  • watchOS
  • tvOS
 

Foreword

The Privacy feature allows you to control the type of information collected according to the legal constraints of each editor depending on regions. You can thus adapt your tagging by a precise management of your various parameters of measurement according to their sensitivity, in the respect of the current regulations.

 

Consent mode

For its proper working, the feature is based on a list of different modes of user consent

  • optIn: for exhaustive measurement after consent.
  • optOut: for restricted measurement with idclient as “opt-out”.
  • noConsent: for a restricted measurement with idclient set to “Consent-No”.
  • exempt: for a hybrid measure with exclusion of data deemed sensitive (subject to the CNIL exemption process).
  • Custom: Since 2.23.0, you can set custom visitor privacy modes. Those modes default restrictions are cloned from: exempt for storage, optout for parameters.

Each visitor mode lists a series of Tracker parameters to be allowed . It is therefore possible to interact at different levels and keep complete control of the data to be transmitted.

When a visitor mode is activated, it is registered for a configurable duration of 397 days, if the applied rules actually allow this registration.

Most of the privacy modes don’t store lifecycle metrics by default, meaning that those metrics can be wrong in your analyses.

 

Tagging methods

The plugin provides a series of useful functions in consent management:

 

setVisitorOptOut

setVisitorOptOut()

Enable “optout” mode.

Example

Privacy.setVisitorOptOut()

[Privacy setVisitorOptOut];

 

setVisitorMode

setVisitorMode(visitorMode)
setVisitorMode(visitorMode, duration)

Activate a specific mode for a defined duration (if not, 397 by default)

ParamTypeDescription
visitorModePrivacy.VisitorModeName of visitor mode
durationIntValidity duration of visitor mode (in days)

Since 2.23.0:

setVisitorMode(visitorMode, visitorConsent, customUserId)
setVisitorMode(visitorMode, visitorConsent, customUserId, duration)
ParamTypeDescription
visitorModeStringName of visitor mode – case sensitive. Predefined modes: optIn, optOut, exempt, noConsent
visitorConsentBoolDoes the visitor consented to be tracked
customUserIdValueString?Overriding of the SDK user ID. null to keep the standard behavior
durationIntValidity duration of visitor mode (in days)

Example

Privacy.setVisitorMode(Privacy.VisitorMode.exempt)
Privacy.setVisitorMode(Privacy.VisitorMode.exempt, duration: 397)
Privacy.setVisitorMode("CustomMode", visitorConsent: true, customUserId: nil)
Privacy.setVisitorMode("Restricted", visitorConsent: false, customUserId: "restricted-id", duration: 7)

[Privacy setVisitorMode:@"exempt"];
[Privacy setVisitorMode:@"exempt" duration:397];
[Privacy setVisitorMode:@"Custom" visitorConsent:YES customUserId:nil];
[Privacy setVisitorMode:@"Restricted" visitorConsent:YES customUserId:@"restricted-id" duration:7];

 

extendIncludeBuffer

extendIncludeBuffer(visitorMode, keys)

Add buffer parameters to the inclusion list specified visitor mode

ParamTypeDescription
visitorModeStringMode for which the buffer will be extended
keysString...Buffer parameters

Buffer parameters can use 3 patterns:

  • an: parameter “an” from the querystring
  • stc/my_parameter: parameter “my_parameter” from “stc” object from querystring (“/” to indicate a sub-oject level)
  • events_data_prop: property “prop” from events data object (“_” to indicate a sub-object level)

Example

Privacy.extendIncludeBuffer(visitorMode: "exempt", keys: "an", "ac") // buffer parameters "an" and "ac" for exempt mode
Privacy.extendIncludeBuffer(visitorMode: "optOut", keys: "stc/custom1", "stc/custom2") // buffer parameter "stc", keys "custom1" and "custom2" for optOut mode
Privacy.extendIncludeBuffer(visitorMode: "exempt", keys: "stc/custom*") // buffer parameter "stc", keys start with "custom" for exempt mode

[Privacy extendIncludeBuffer:@"exempt" keys:[NSArray arrayWithObjects:@"an", @"ac", nil]]; // buffer parameters "an" and "ac" for Exempt mode
[Privacy extendIncludeBuffer:@"exempt" keys:[NSArray arrayWithObjects:@"stc/custom1", @"stc/custom2", nil]]; // buffer parameter "stc", keys "custom1" and "custom2"
[Privacy extendIncludeBuffer:@"exempt" keys:[NSArray arrayWithObjects:@"stc/custom*", nil]]; // buffer parameter "stc", keys start with "custom"

 

extendIncludeStorage

Since 2.23.0

extendIncludeStorage(visitorMode, storageFeatureKeys)

Add storage to the inclusion list of the specified visitor mode

ParamTypeDescription
visitorModeStringMode for which the storage will be extended – case sensitive. Predefined modes: optIn, optOut, exempt, noConsent
storageFeatureKeysStorageFeature...Storage keys. Available: campaign, userId, privacy, identifiedVisitor, crash, lifecycle

Call order is important when using this method: extendIncludeStorage must be called before setVisitorMode in order to be taken into account.

Example

Privacy.extendIncludeStorage(visitorMode: "exempt", storageFeatureKeys: Privacy.StorageFeature.lifecycle); // Add Lifecycle storage to Exempt mode
Privacy.setVisitorMode(Privacy.VisitorMode.exempt);

[Privacy extendIncludeStorage:@"exempt" storageFeatureKeys:[NSArray arrayWithObjects:@"lifecycle", nil]]; // Add Lifecycle storage to Exempt mode
[Privacy setVisitorMode:@"exempt"];

 

Use cases

 

Activating the CNIL hybride mode

The activation of the hybrid mode exempt allows very limited measurement by the Tracker. Only the “absolutely necessary” parameters are allowed and tracked.

Allowed parameters by default: s, vm, vc, mh, idclient, p, olt, vtag, ptag, ts, click, type, cn, dg, apvr, mfmd, model, manufacturer, os, stc/crash/*
Added since 2.23.0: ref

Allowed storage by default: privacy, userId, crash

Of course, the parameter inclusion list can be extended if necessary. For example, it is possible to add a site custom variable to this list if it is considered that the data is strictly necessary, using the extendIncludeBuffer() method.

Example

Privacy.extendIncludeBuffer(Privacy.VisitorMode.exempt, keys: "x1") // The site indicator "x1" is added to the inclusion list

[Privacy extendIncludeBuffer:@"exempt" keys:[NSArray arrayWithObjects:@"x1", nil]];

By default, the hits generated when the Opt-out mode is activated are sent. You can if you wish block these sendings by overloading the Tracker configuration variable sendHitWhenOptOut.

Example

var tracker = ATInternet.sharedInstance.defaultTracker
tracker.setSendHitWhenOptOutEnabled(false, sync: true, completionHandler: nil) // true by default

Tracker* tracker = [[ATInternet sharedInstance] defaultTracker];
[tracker setSendHitWhenOptOutEnabled:NO sync:YES completionHandler:nil];

 

Activating a custom mode

Privacy.extendIncludeStorage(visitorMode: "Custom", storageFeatureKeys: Privacy.StorageFeature.lifecycle, Privacy.StorageFeature.crash)
Privacy.extendIncludeBuffer(visitorMode: "Custom", keys: "p", "vtag", "at", "ac", "events_*")
Privacy.setVisitorMode("Custom", visitorConsent: false, customUserId: nil)

[Privacy extendIncludeStorage:@"Custom" storageFeatureKeys:[NSArray arrayWithObjects:@"lifecycle", nil]];
[Privacy extendIncludeBuffer:@"Custom" keys:[NSArray arrayWithObjects:@"p", @"vtag", @"at", @"ac", @"events_*", nil]];
[Privacy setVisitorMode:@"Custom" visitorConsent:YES customUserId:nil];