You can configure the behavior of the Adjust SDK by assigning properties in the Adjust.initSdk
method.
Required configuration
To configure the Adjust SDK, you need to call the Adjust.initSdk
method with the following arguments:
appToken
(string
): Your Adjust app token.environment
(string
): The environment you want to run the SDK in. Passsandbox
to run the SDK in sandbox mode for testing. Passproduction
to run the SDK in production mode for release.
Logging options
The Adjust SDK provides configurable log levels to return different amounts of information. The following log levels are available:
Value | Description |
---|---|
verbose | Enable full logging |
info | Return information, warnings, and error logs |
warning | Return warnings and error logs |
error | Return only error logs |
none | Disable all logging |
You can set the log level by specifying an logLevel
argument in the initSdk
method. The SDK defaults to error
if no value is passed.
Set log output
You can delegate a log output location in your web app to show logs directly on the screen. To do this, specify an HTML selector in the logOutput
argument in the initSdk
method. The SDK logs will print to this container.
Initialization options
Set external device identifier
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. Pass your external device ID as the externalDeviceId
argument in your Adjust.initSdk
call.
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.
Set default link token
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. Pass your token in the defaultTracker
argument of your Adjust.initSdk
call.
Set storage namespace
The Adjust SDK creates a storage namespace to store data in by default. You can override this an specify a custom namespace if you want to control where the data ends up.
Any data that the SDK has stored in the default namespace will be moved the custom namespace when it’s set.
You can set an custom namespace by specifying a namespace
property in the initSdk
method.
Dynamic configuration
Dynamic configuration options may be changed during the SDK’s lifecycle in response to events or actions taken by the user.
Toggle offline mode
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 the browser’s IndexedDB, or in localStorage if IndexedDB isn’t supported.
You can toggle offline mode at any time by calling the switchToOfflineMode
method with the following argument:
Event buffering
The SDK sends all saved information to Adjust’s servers when you disable offline mode. To do this, call the switchBackToOnlineMode
method.
Disable the SDK
The Adjust SDK runs by default when your app is open. You can disable and re-enable the Adjust SDK to pause and resume recording. When you disable the Adjust SDK, it doesn’t send any data to Adjust’s servers.
You can disable the SDK at any time by calling the stop
method.
Reenable the SDK
You can restart the SDK at any time by calling the restart
method.