Privacy

 

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.

 

Visitor privacy 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.21.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();
 

setVisitorOptIn

setVisitorOptIn()

Enable “optin” mode.

Example

Privacy.setVisitorOptIn();
 

setVisitorMode

setVisitorMode(visitorMode)
setVisitorMode(visitorMode, duration)

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

ParamTypeDescription
visitorModeVisitorModeName of visitor mode.
durationintValidity duration of visitor mode (in days)

Since 2.21.0:

setVisitorMode(visitorMode, visitorConsent, customUserIdValue)
setVisitorMode(visitorMode, visitorConsent, customUserIdValue, duration)
ParamTypeDescription
visitorModeStringName of visitor mode – case sensitive. Predefined modes: OptIn, OptOut, Exempt, NoConsent
visitorConsentbooleanDoes the visitor consented to be tracked
customUserIdValueStringOverriding of the SDK user ID. null to keep the standard behavior
durationintValidity duration of visitor mode (in days)

Example

Privacy.setVisitorMode(Privacy.VisitorMode.NoConsent);
Privacy.setVisitorMode(Privacy.VisitorMode.Exempt, 397);
Privacy.setVisitorMode("CustomMode", true, null);
Privacy.setVisitorMode("Restricted", false, "restricted-id", 7);
 

getVisitorMode

getVisitorMode() ⇒ Privacy.VisitorMode

Retrieve the current visitor mode.

Example

Privacy.VisitorMode visitorMode = Privacy.getVisitorMode();
 

extendIncludeBufferForVisitorMode

extendIncludeBufferForVisitorMode(visitorMode, keys)

Add buffer parameters to the inclusion list of the specified visitor mode

ParamTypeDescription
visitorModeStringMode for which the buffer will be extended – case sensitive. Predefined modes: OptIn, OptOut, Exempt, NoConsent
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.extendIncludeBufferForVisitorMode("Exempt", "an", "ac"); // buffer parameters "an" and "ac" for Exempt mode
Privacy.extendIncludeBufferForVisitorMode("OptOut", "stc/version"); // buffer parameter "version" of the "stc" object  for OptOut mode
Privacy.extendIncludeBufferForVisitorMode("Exempt", "events_data_version"); // buffer parameter "version" of the events data object for Exempt mode
 

extendIncludeStorageForVisitorMode

Since 2.21.0

extendIncludeStorageForVisitorMode(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
storageFeatureKeysPrivacy.StorageFeature...Storage keys. Available: Campaign, UserId, Privacy, IdentifiedVisitor, Crash, Lifecycle

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

Example

Privacy.extendIncludeStorageForVisitorMode("Exempt", Privacy.StorageFeature.Lifecycle); // Add Lifecycle storage to Exempt mode
Privacy.setVisitorMode(Privacy.VisitorMode.Exempt);
 

Use cases

 

Activating the CNIL hybrid mode

The activation of the hybrid mode exempt allows very limited measurement by the Tracker. Only the “strictly 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/*
Allowed since 2.21.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 extendIncludeBufferForVisitorMode() method.

Example

Privacy.extendIncludeBufferForVisitorMode("Exempt", "x1"); // The site indicator "x1" is added to the Exempt inclusion list
Privacy.setVisitorMode(Privacy.VisitorMode.Exempt);
 

Activating the “Opt-out” mode

Activating the optout mode results in a strictly limited action by the Tracker.

Allowed parameters by default: s, vm, vc, mh, idclient, ts, olt, cn, click, type

Allowed storage by default: Privacy

The customer ID then takes the value “opt-out” and the traffic generated is found in the category of traffic excluded at the analysis level.

Example

Privacy.setVisitorOptOut();

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

Tracker tracker = ATInternet.getInstance().getDefaultTracker();
tracker.setSendHitWhenOptOutEnabled(false, null, true); // true by default
 

Activating the “No-consent” mode

Activating the no-consent mode results in a strictly limited action by the Tracker.

Allowed parameters by default: s, vm, vc, mh, idclient, ts, olt, cn, click, type

No storage is allowed on this mode.

The customer ID then takes the value “Consent-NO” and the generated traffic can be excluded at the analysis level.

Example

Privacy.setVisitorMode(Privacy.VisitorMode.NoConsent);
 

Activating the “Opt-in” mode

The activation of the optin mode results in an exhaustive measurement by the Tracker. All parameters are then stored and sent. This method has to be called after an Internet user has given his consent.

Example

Privacy.setVisitorOptIn();
 

Activating a custom mode

Privacy.extendIncludeStorageForVisitorMode("Custom", Privacy.StorageFeature.Lifecycle, Privacy.StorageFeature.Crash);
Privacy.extendIncludeBufferForVisitorMode("Custom", "p", "vtag", "at", "ac", "events_*");
Privacy.setVisitorMode("Custom", false, null)
 

ACPM (OJD) case

If your site/app is certified with the french ACPM (OJD), you have to add stc/device to your include buffer:

Privacy.extendIncludeBufferForVisitorMode("Exempt", "stc/device");
Last update: 10/03/2021