Personalization

setDoNotTrack - Personalization JavaScript API

End-of-sale notice!

Acquia announces the end-of-sale for Acquia Personalization effective July 1, 2024. Customers with active service contracts will continue to receive support. If you are interested in experimentation and optimization, contact Acquia Sales Team to get information about Acquia Convert powered by VWO.

End-of-life notice!

Acquia announces the end-of-life for the acquia_lift module effective December 31, 2025. Acquia recommends you to update your application to the current version of Acquia Personalization. For any assistance related to migration, contact Acquia Support.

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.

Using cookies to track visitors

To identify website visitors between their visits, Personalization uses cookies, or small text files stored in each visitor’s local browser cache. Each time your website is displayed by a visitor, Personalization searches for any of its identifier cookies in an attempt to match the visitor with information stored in Personalization. Information about the visit can then be associated with the appropriate visitor for a continued refinement of the visitor’s profile.

If a user indicates to Personalization that they do not want to be tracked, Personalization updates one or both of the following cookies in the visitor’s local browser cache:

  • tc_dnt - This cookie is populated if do not track is enabled.
  • tc_3dnt - This cookie is populated if both do not track is enabled and third-party cookies are enabled. For more information about using third-party cookies, see Managing your visitor capture settings.

When do not track is enabled for a visitor, the visitors’ person record in the Personalization service is updated with a flag to not track their activities. From that point on, no additional information about the visitor is sent to the Personalization service.

For more information about the cookies that Personalization uses to track website visitors, see Cookies used by Personalization.

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.

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Acquia Help

Filter by product:

Personalization common questions