Compliance 2.x.x

Opt-Out Of Data Tracking

To opt-out of data tracking by the SDK use the optOutDataTracking( ) method as shown below. Once you have opted out of data tracking you need to explicitly opt-in to start tracking any event OR attributes for the user.

c#
// shouldOptOut: Bool indicating opt-out status, set true if you want to opt-out
MoEngageClient.optOutDataTracking(shouldOptOut);

Opt-Out of Push Notification

To opt-out of push notification from MoEngage use the optOutPushTracking() method as shown below. Once you have opted out of push notification you need to explicitly opt-in to enable push notifications for the user.

c#
// shouldOptOut: Bool indicating opt-out status, set true if you want to opt-out
MoEngageClient.optOutPushTracking(shouldOptOut);
warning

Warning

Only for iOS:

  • In this method, we are tracking an attribute for the user MOENGAGE_PUSH_OPTED_OUT. Make sure you are using this Attribute to segment out the users while creating the campaign.

  • This method will not disable Push Notification for the app but only track an attribute as mentioned above which can be used while setting segmentation for the campaign.

  • To disable Push Notifications redirect the user to App settings screen.

Opt-Out of In-App Notification

To opt-out of in-app notification use the optOutInAppTracking() method as shown below. Once you have opted out of in-app notification you need to explicitly opt-in to show any inApp campaign to the user.

c#
// shouldOptOut: Bool indicating opt-out status, set true if you want to opt-out
MoEngageClient.optOutInAppTracking(shouldOptOut);

Enable/Disable SDK

If you don't want the MoEngage SDK to track any user information or send any data to the MoEngage System use the DisableSdk() method as shown below:

c#
MoEngageClient.DisableSdk();

Once this API is called all the SDK APIs will be non-operational. SDK will be disabled until EnableSdk() is called.
Once you have the user's consent use the below API to enable the SDK.

c#
MoEngageClient.EnableSdk();

The above methods are available from the Unity Plugin version 1.2.0.

Native SDK Initialisation

Based on the compliance policy you can optionally choose to initialize the SDK in a disabled state. To do so you can pass in a boolean value stating the SDK state as disabled while initializing the SDK.

ANDROID:

Kotlin Java
import com.moengage.unity.wrapper.MoEInitializer
import com.moengage.core.MoEngage

// this is the instance of the application class and "XXXXXXXXXXX" is the APP ID from the dashboard.
val moEngage = MoEngage.Builder(this, "XXXXXXXXXXX")
// Set isSdkEnabled as false if you want to initialize the in a disabled state.
MoEInitializer.initialize(getApplicationContext(), moEngage, isSdkEnabled)

iOS:

In the case of iOS, SDK is initialized in the MoEUnityAppController class. Here update the initialization method to include disable SDK parameter as shown below:

Objective-C
@implementation MoEUnityAppController

- (instancetype)init
{
    self = [super init];
    if (self) {
        UnityRegisterAppDelegateListener(self);
    }
    return self;
}

# pragma mark - UIApplicationDelegate methods

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [super application:application didFinishLaunchingWithOptions:launchOptions];

    // SDK Initialization, with SDK State(isSdkEnabled) as false for disabling the SDK
    [[MoEUnityInitializer sharedInstance] intializeSDKWithLaunchOptions:launchOptions andSDKState:isSdkEnabled];
  
    return YES;
}

@end

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?