Unity Advanced Features

Advanced Features

πŸ“˜

Note

If you are using Unity SDK v3.0.0, use Clevertap instead of ClevertapBindings method.

Debugging

During development, we recommend that you set the SDK to DEBUG mode, in order to log warnings or other important messages to the iOS logging system. This can be done by setting the debug level.

Set Debug Level

Debug level can be one of the following:

  • -1: Disables all debugging. You can set the debugLevel to -1 if you want to disable CleverTap logs for the production environment.
  • 0: Default, shows minimal SDK integration related logging.
  • 2: Shows debug output.
  • 3: Shows verbose output.
CleverTapBinding.SetDebugLevel(debugLevel);

🚧

Note

To get the SDK logs in the killed state, add platform-specific debugging.

Native Display

On Display Units Loaded

CleverTap.addListener(CleverTap.CleverTapDisplayUnitsLoaded, (event) => {
        _handleCleverTapDisplayUnitsLoaded(CleverTap.CleverTapDisplayUnitsLoaded, event);
    });

function _handleCleverTapDisplayUnitsLoaded(eventName, event) {
    console.log('CleverTap Display Unit Event - ', eventName, event);
}

Get All Display Units

function _handleCleverTapDisplayUnitsLoaded(eventName, event) {
    console.log('CleverTap Display Unit Event - ', eventName, event);
    CleverTap.getAllDisplayUnits((err, res) => {
        console.log('All Display Units: ', res, err);
    });
}

Display unit viewed event for ID

CleverTap.pushDisplayUnitViewedEventForID('Display Unit Id');

Display unit clicked event for ID

CleverTap.pushDisplayUnitClickedEventForID('Display Unit Id');

App Personalization

Enable Personalization

CleverTap.enablePersonalization();

Disable Personalization

CleverTap.disablePersonalization();

Attributions

Push Install Referrer

CleverTap.pushInstallReferrer("source", "medium", "campaign");

GDPR

Set Opt Out

CleverTap.setOptOut(false); ///Will opt in the user to send data to CleverTap
CleverTap.setOptOut(true); ///Will opt out the user to send data to CleverTap

Enable Device Networking Info Reporting

// Will opt out the user to send Device Network data to CleverTap
CleverTap.enableDeviceNetworkInfoReporting(false);
// Will opt in the user to send Device Network data to CleverTap
CleverTap.enableDeviceNetworkInfoReporting(true);

Set Offline

// Will set the user online
CleverTap.setOffline(false);
// Will set the user offline
CleverTap.setOffline(true);