Skip to main content

Additional Features

User attribution

You can access your user's current attribution information by using the following method:

attributionCallback function

This param accepts function, and it's a callback function for the attribution change. Two arguments are provided to the callback, first one is an internal event name (can be ignored), and the other one is the object which holds information about the changed attribution

Example:

Adtrace.initSdk({
// ... other params go here, including mandatory ones
attributionCallback: function (e, attribution) {
// e: internal event name, can be ignored
// attribution: details about the changed attribution
}
});

getAttribution

Example:

const attribution = Adtrace.getAttribution();
info

Current attribution information is only available after our backend tracks the app install and triggers the attribution callback. It is not possible to access a user's attribution value before the SDK has been initialized and the attribution callback has been triggered.

attribution object is generally formatted as below.

ValuesData typeDescription
trackerTokenstringThe token of the tracker to which the device is currently attributed.
trackerNamestringThe name of the tracker to which the device is currently attributed.
networkstringThe name of the network to which the device is currently attributed.
campaignstringThe name of the campaign to which the device is currently attributed.
adgroupstringThe name of the adgroup to which the device is currently attributed.
creativestringThe name of the creative to which the device is currently attributed.
adidstringThe unique Adtrace ID assigned to the device.

Device ID

Get web_uuid

To identify unique web users in Adtrace, Web SDK generates an ID known as web_uuid whenever it tracks first session. The ID is created per subdomain and per browser. The identifier follows the Universally Unique Identifier (UUID) format.

To get web_uuid use the following method:

getWebUUID

Example:

const webUUID = Adtrace.getWebUUID();

Global callback parameters

There are several methods available for global callback parameters like adding, removing and clearing them. Here is the list of each available method:

addGlobalCallbackParameters

It's possible to add global callback parameters, which will be appended automatically to each session and event request. Note that callback params passed directly to trackEvent method will override existing global callback params. This method accepts an array is the same format as for callbackParams parameter from trackEvent method

Example:

Adtrace.addGlobalCallbackParameters([
{key: 'key1', value: 'value1'},
{key: 'key2', value: 'value2'}
]);

removeGlobalCallbackParameter

To remove particular callback parameter use this method by providing the key of a global callback param which needs to be removed

Example:

Adtrace.removeGlobalCallbackParameter('key1');

clearGlobalCallbackParameters

In order to clear all global callback parameters simply call this method

Example:

Adtrace.clearGlobalCallbackParameters();

Global partner parameters

It's possible to add, remove and clear global partner parameters in the similar way as for global callback parameters. Here is the list of each available method:

addGlobalPartnerParameters

It's possible to add global partner parameters, which will be appended automatically to each session and event request. Note that partner params passed directly to trackEvent method will override existing global partner params. This method accepts an array is the same format partnerParams parameter from trackEvent method

Example:

Adtrace.addGlobalPartnerParameters([
{key: 'key1', value: 'value1'},
{key: 'key2', value: 'value2'}
]);

removeGlobalPartnerParameter

To remove particular partner parameter use this method by providing the key of a global partner param which needs to be removed

Example:

Adtrace.removeGlobalPartnerParameter('key1');

clearGlobalPartnerParameters

In order to clear all global partner parameters simply call this method

Example:

Adtrace.clearGlobalPartnerParameters();

Other features

customUrl string

By default, all requests go to adtrace's endpoints. You are able to redirect all requests to your custom endpoint

defaultTracker string

By default, users who are not attributed to any campaigns will be attributed to the Organic tracker of the app. If you want to overwrite this behaviour and attributed this type of traffic under a different tracker, you can use this method to set a different default tracker.

Offline/Online mode

By default, when initiated Adtrace SDK is always in online mode. But you can put it into offline mode if you want to pause all network requests such as tracking events and sessions (although initial session will ignore this mode and will be sent anyway). There are two methods available to switch on and off the offline mode:

switchToOfflineMode

This method will put the Adtrace SDK into offline mode

Example:

Adtrace.switchToOfflineMode();

switchBackToOnlineMode

This method will put the Adtrace SDK back to online mode

Adtrace.switchBackToOnlineMode();

Stop/Restart SDK

It's possible to completely stop the SDK from running in certain situations. This means that SDK will stop tracking sessions and events and in general will stop working entirely. But it's possible to restart it after some time. Here are available methods for this functionality:

stop

This will stop running Adtrace SDK

Example:

Adtrace.stop();

restart

This will restart Adtrace SDK

Example:

Adtrace.restart();

GDPR Forget Me (SDK ONLY)

There is functionality available to GDPR Forget particular user. This will notify our backend behind the scene and will stop Adtrace SDK from running. There is one method available for this:

gdprForgetMe

This method will stop Adtrace SDK from running and will notify Adtrace backend that user wants to be GDPR forgotten. Once this method is run it's not possible to restart Adtrace SDK anymore.

Example:

Adtrace.gdprForgetMe();

Marketing Opt-out (SDK ONLY)

There is functionality for the Marketing Opt-out, which is disabling third-party sharing ability. This will notify our backed in the same manner as it does for GDPR Forget me.

There is one method available for this:

disableThirdPartySharing (SDK ONLY)

Example:

Adtrace.disableThirdPartySharing();

Setting referrer

You may want to set referrer to trigger sdk_click manually.

To set referrer use the following method:

setReferrer

Example:

Adtrace.setReferrer("adtrace_external_click_id%3DEXTERNAL_CLICK_ID");
Remember

Please note that referrer should be properly URL-encoded.

note

For proper attribution this method should be called as close as possible to SDK initialization.