Skip to content

Geolocation Rulesets

This feature is very useful when you have multiple Settings IDs to represent your CMP configuration for different sets of countries or regions. It's very common when you have an application that can be globally used and you have to support different Legal Frameworks.

Instead of doing this Rule Engine on your application, Usercentrics provides a way for you to configure your mobile app to rely on only one Identifier string (like a Settings ID) and have the correct configuration according to user location.

By following the instructions on Initialize the SDK, the UsercentricsOptions is created using a settingsId. In order to use this API, you have to configure using only the ruleSetId. See below:

  1. Configure and initialize Usercentrics after app launch.

    // On AppDelegate
    import Usercentrics
    
    let options = UsercentricsOptions()
    options.ruleSetId = <RuleSetId>
    UsercentricsCore.configure(options: options)
    
    // On Application
    import com.usercentrics.sdk.*
    
    val options = UsercentricsOptions(ruleSetId = <RuleSetId>)
    Usercentrics.initialize(this, options)
    
    // e.g place this inside the [initState] of the Entry Point Widget
    import 'package:usercentrics_sdk/usercentrics_sdk.dart';
    
    Usercentrics.initialize(
      ruleSetId: <RuleSetId>,
    );
    
    // On your App entrypoint
    import { Usercentrics, UsercentricsOptions } from '@usercentrics/react-native-sdk';
    
    const options = new UsercentricsOptions({
        ruleSetId: <RuleSetId>
    });
    Usercentrics.configure(options);
    
  2. 🚀 The configuration set on Company configuration page will be applied and the correct Settings ID will be automatically loaded.