Targeting and recommending content to website visitors requires that you collect data about those visitors. If you don’t know information about visitors, you cannot effectively display personalized content that intrinsically meets their needs.
Some visitors, however, do not want to be tracked. To accommodate this situation, you can use the Personalization JavaScript API reference to add functionality to your website that allows visitors the ability to opt in or out of being tracked.
Allowing visitors to control their tracking settings
Using the JavaScript API, Personalization allows you to update your website with settings that visitors can use to control their own do not track settings.
Depending on a visitor’s requirement, use the appropriate JavaScript function call from the following list with whatever decision-making element you add to your website:
Enable the do not track feature for a visitor
_tcaq.push(['setDoNotTrack', true]);
- Disable the do not track feature for a visitor: This does not currently work. Instead, use one of the following methods to disable tracking:
- Manually delete the user cookies.
Run the following commands in the console:
document.cookie.replace("tc_dnt=true", "tc_dnt=false"); _tcaq.push(['setDoNotTrack', false]);
For GDPR-compliant websites, this setting defaults to true
for all visitors during their initial website visit. When the user accepts cookies, the setting updates to false
, enabling user tracking.
Note
Public _tcaq
functions are only available after lift-capture.js
is loaded on a page after personalization return. You will know lift-capture.js
hasn’t loaded on a page if you receive the following reference error:
ReferenceError: _tcaq is not defined
Monitoring visitors’ do not track settings
In the Personalization interface, you can review properties about visitors in the Person details page. To determine if a visitor has enabled or disabled the do not track setting on your website, review the visitor’s Do Not Track property:
- No: Do not track is disabled.
- Yes: Do not track is enabled.
For more information about reviewing visitors’ Person details, see Examining visitor information.