Configuring Audience Logic Using Geolocation Rules

Audience Logic is a feature within the geolocation rules section that enables you to apply conditional logic to your individual geolocation rules to create a more customized Consent Management Platform (CMP) experience based on specific attributes of your end user.

To configure Audience Logic

  1. On the Cookie Consent menu, select Geolocation Rules. The Geolocation Rule Groups screen appears.

  2. Select a geolocation rule group from the list. The Geolocation Rule Group Details screen appears.
    Note:

    For information on creating a new rule group, see Configuring Geolocation Rules.

  3. Select the Use Audience Logic checkbox to enable Audience Logic.
  4. Enter a name and define the logic for your condition.


  5. Click the Save button. Your Audience Logic condition displays.


Each condition has its own set of geolocation configurations. Else configurations will load if the Audience Logic condition is not met or is unknown.

Example Configuration: GPC

When the Global Privacy value is TRUE, the condition will be hit.

If TRUE:







You can leverage the following code in the JavaScript entry field to load your configurations for the GPC condition:

CODE
navigator.globalPrivacyControl

If Else (FALSE/undefined):





Example Configuration: Mobile Devices

Present the end user with a different CMP experience when the browser user agent is in the defined mobile device list.



You can leverage the following code in the JavaScript entry field to load your configurations for the mobile condition:

CODE
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)

Example Use Cases

Detect if the page is an iframe

If the page is loaded in an iFrame, hide the banner and opt out of all preferences.

Logical Condition:

window.top !== window.self

Example:

IF window.top !== window.self is TRUE,

THEN hide the banner AND set consent to opt-out.

Detect if browser is Safari

Show a banner if the user is visiting from Safari. If not, do not display the banner.

Logical Condition

navigator.userAgent.indexOf('Safari') != -1 &&

navigator.userAgent.indexOf('Chrome') == -1 &&

navigator.userAgent.indexOf('CriOS') == -1 &&

navigator.userAgent.indexOf('FxiOS') == -1

Explanation

This condition checks if the user agent contains "Safari" but excludes Chrome and Firefox on iOS (as they also include "Safari" in their user agents). If "Safari" is found and none of the other browsers are present, the visitor is using Safari.

Example

IF navigator.userAgent.indexOf('Safari') != -1 &&

navigator.userAgent.indexOf('Chrome') == -1 &&

navigator.userAgent.indexOf('CriOS') == -1 &&

navigator.userAgent.indexOf('FxiOS') == -1 IS TRUE

THEN Safari is being used, so show the banner.

ELSE Safari is not being used, so do not show the banner.

Things to Know

  • When consent logging is enabled, a collection point will be created per condition. You cannot use the field to write a cookie or a variable.

  • Any browser values or custom variables must be available prior to the variable when using Audience Logic.

  • A limit of five audience logic conditions per geolocation rule is recommended to maintain optimal performance.