Skip to content

Do Not Track (DNT)

The Do Not Track (DNT) feature in Logspot SDK provides an option for users to opt-out of tracking by the SDK. This helps enhance user privacy by allowing them to control their data collection preferences. As an SDK user, you can enable the DNT feature through the SDK configuration or by including a dnt query parameter in the URL.

Enabling Do Not Track via URL Query Parameter

Another way to enable the DNT feature is by including a dnt query parameter in the URL. When the dnt query parameter is present in the URL, the SDK will disable tracking for that user, regardless of the cookiesDisabled flag in the configuration.

Example:

https://example.com/?dnt

User Preference Persistence

When a user visits the website with the dnt query parameter in the URL, the SDK will remember their DNT preference by storing a value in the browser’s localStorage. This ensures that the user’s DNT preference is remembered even if they visit the website without the dnt query parameter in the future.

Disabling cookies through Configuration

To disable cookies through the SDK configuration, you can set the cookiesDisabled flag in the configuration object when initializing the SDK. When this flag is set to true, the SDK will disable tracking for all users.

Example:

const config = {
publicKey: 'your_api_key',
cookiesDisabled: true,
};
Logspot.init(config);

Enabling Browser DNT Support

To enable support for the browser’s DNT setting in Logspot SDK, add the enableBrowserDNT flag to the configuration object when initializing the SDK. When this flag is set to true, the SDK will respect the user’s browser DNT setting.

With this configuration, the SDK will check the user’s browser DNT setting. If the user has enabled DNT in their browser, the SDK will disable tracking for that user.

const config = {
publicKey: 'your_api_key',
enableBrowserDNT: true,
};
Logspot.init(config);

Please note that not all browsers support the DNT feature, and even if they do, some websites and advertisers might not respect the DNT signal. By setting enableBrowserDNT to true, you are making sure that Logspot SDK respects the user’s DNT preference, enhancing user privacy.