Skip to main content

Configuration

Use the methods in this guide to configure the behavior of the Adtrace Web SDK.

The SDK supports two kinds of configuration:

TypeWhen you set itCan change after init?
Read-onlyIn Adtrace.initSdk({ ... }) on first loadNo
DynamicOn Adtrace at any time after initSdkYes

Initialize the SDK

Read-only options are passed to Adtrace.initSdk. Call it as early as possible on each page load.

Required parameters

ParameterTypeDescription
appTokenstringYour Adtrace app token from the Adtrace panel.
environmentstringUse sandbox for testing or production for release traffic.

Example

initSdk
Adtrace.initSdk({
appToken: '{YourAppToken}',
environment: 'sandbox',
logLevel: 'verbose',
});

Set optional read-only parameters in the same object before the SDK starts. See the pages below for each option.

Important

For proper attribution, call setReferrer as close as possible to SDK initialization.

Read-only configuration

Set these in initSdk before the SDK sends the first session.

Dynamic configuration

Change these at runtime after initSdk.