adjust-icon

Configuration

Use the methods in this document to configure the behavior of the Adjust SDK.

Instantiate your config object

Method signature
public AdjustConfig(string appToken, AdjustEnvironment environment, bool allowSuppressLogLevel)

To configure the Adjust SDK, you need to instantiate an AdjustConfig object. This object contains the read-only configuration options that you need to pass to the Adjust SDK.

To instantiate your config object, create a new AdjustConfig instance and pass the following parameters:

  • appToken (string): Your Adjust app token.
  • environment (AdjustEnvironment): The environment you want to run the SDK in. Pass AdjustEnvironment.Sandbox to run the SDK in sandbox mode for testing. Pass AdjustEnvironment.Production to run the SDK in production mode for release.
  • allowSuppressLogLevel (bool): Whether to suppress all logging. Set to true to suppress logging or false to enable logging.
AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, false);
// ...
Adjust.InitSdk(adjustConfig);

Read-only configuration

Read-only configuration options are set in your AdjustConfig instance before the initialization of the SDK. They can’t be changed while the SDK is running. You MUST configure any options you want to use before running Adjust.InitSdk.

Set your logging level

Property declaration
public AdjustLogLevel? LogLevel { get; set; }

The Adjust SDK provides configurable log levels to return different amounts of information. The following log levels are available:

Log levelDescription
AdjustLogLevel.VerboseEnable all logging
AdjustLogLevel.DebugEnable debug logging
AdjustLogLevel.InfoOnly show info level logs (default option)
AdjustLogLevel.WarnDisable info logging
AdjustLogLevel.ErrorDisable warning level logging and below
AdjustLogLevel.AssertDisable error level logging and below
AdjustLogLevel.SuppressSuppress all logging

You can set your log level by assigning a value to the LogLevel property on your AdjustConfig instance.

AdjustConfig config = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
//...
config.LogLevel = AdjustLogLevel.Error;
//...
Adjust.InitSdk(config);

Set external device identifier

Property declaration
public string ExternalDeviceId { get; set; }

An external device identifier is a custom value that you can assign to a device or user. They help you recognize users across sessions and platforms. They can also help you deduplicate installs by user so that a user isn’t counted as duplicate new installs. Contact your Adjust representative to get started with external device IDs.

You can use an external device ID as a custom identifier for a device. This helps you keep continuity with your other systems. You can set your external device ID by assigning it to the ExternalDeviceId property on your AdjustConfig instance.

AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
//...
adjustConfig.ExternalDeviceId = "{Your-External-Device-Id}";
//...
Adjust.InitSdk(adjustConfig);

If you want to use the external device ID in your business analytics, you can pass it as a session callback parameter.

You can import existing external device IDs into Adjust. This ensures that the Adjust servers match future data to your existing device records. Contact your Adjust representative for more information.

Property declaration
public string DefaultTracker { get; set; }

You can configure a default link token if your app is preinstalled on a device. When a user opens the preinstalled app for the first time, the install is attributed to the default link token. To set your default link token, assign it to the DefaultTracker property on your AdjustConfig instance.

AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox);
//...
adjustConfig.DefaultTracker = "{TrackerToken}";
//...
Adjust.InitSdk(adjustConfig);

Receive ad spend data in attribution

Property declaration
public bool? IsCostDataInAttributionEnabled { get; set; }

By default, the Adjust SDK doesn’t receive ad spend data as part of a user’s attribution. You can configure the SDK to request this information by setting the IsCostDataInAttributionEnabled property on your AdjustConfig instance to true.

Cost data is accessible in the user’s attribution information.

AdjustConfig adjustConfig = new AdjustConfig("{Your App Token}", AdjustEnvironment.Sandbox);
adjustConfig.LogLevel = AdjustLogLevel.Verbose;
adjustConfig.IsCostDataInAttributionEnabled = true;
Adjust.InitSdk(adjustConfig);

Enable background recording

Property declaration
public bool? IsSendingInBackgroundEnabled { get; set; }

By default, the Adjust SDK doesn’t send information to Adjust when your app is running in the background. You can configure the SDK to send information while your app is running in the background by setting the IsSendingInBackgroundEnabled property on your AdjustConfig instance to true.

AdjustConfig adjustConfig = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox);
//...
adjustConfig.IsSendingInBackgroundEnabled = true;
//...
Adjust.InitSdk(adjustConfig);

Dynamic configuration

Dynamic configuration options may be changed during the SDK’s lifecycle in response to events or actions taken by the user.

Activate offline mode

Method signature
public static void SwitchToOfflineMode();

The Adjust SDK sends event and session data to Adjust’s servers in real time. You can pause the sending of information by putting the SDK in offline mode. In offline mode the SDK stores all data in a local file on the device. The SDK sends this information to Adjust’s servers when you disable offline mode.

To enable offline mode, call the Adjust.SwitchToOfflineMode method.

Adjust.SwitchToOfflineMode();

Deactivate offline mode

Method signature
public static void SwitchBackToOnlineMode();

You can re-enable the SDK by calling the Adjust.SwitchBackToOnlineMode method. This prompts the SDK to resume sending information.

Adjust.SwitchBackToOnlineMode();

Set push tokens

Method signature
public static void SetPushToken(string pushToken)

Push tokens are used for Audiences and client callbacks. They’re also required for Uninstall and reinstall measurement.

You can update your push token at any time by calling the Adjust.SetPushToken method and passing the following arguments:

  • pushToken (string): Your push token.
Adjust.SetPushToken("{YourPushToken}");

Disable the SDK

Method signature
public static void Disable()

The Adjust SDK runs by default when your app is open. You can disable the Adjust SDK to stop sending information to Adjust by calling the Adjust.Disable method. When you disable the Adjust SDK, no data is sent to Adjust and no information is recorded by the SDK. This means that any Adjust method called when the SDK is disabled won’t record anything.

Adjust.Disable();

Enable the SDK

Method signature
public static void Enable()

If you’ve disable the SDK and want to re-enable it, call the Adjust.Enable method. When the SDK is enabled, it will send information to Adjust’s servers.

Adjust.Enable();

Check enabled status

Method signature
public static void IsEnabled(Action<bool> callback)

You can check if the Adjust SDK is enabled at any time by calling the Adjust.IsEnabled method and passing a callback function. The status is returned asynchronously and passed to your callback function as a boolean value.

Adjust.IsEnabled(isEnabled =>
{
// Your callback function
});