Integrate third-party Tracking consent manager

Sitefinity CMS has out-of-the-box support for managing users’ consent to process their personal information. It consists of UI to show to the website visitors and the infrastructure in the Sitefinity backend to manage the users’ choice. For more information, see Tracking consent.

If you require custom functionality, you can integrate a third-party tracking consent manager.

To integrate a third-party tracking consent manager in your Sitefinity CMS site, you configure your Sitefinity CMS and write JavaScript to connect both systems. In this article, you will learn how to:

  • Enable Sitefinity CMS infrastructure for tracking consent.
  • Hide the built-in dialog from the website visitors.
  • Write the JavaScript code to integrate both systems.
  • Set up Sitefinity CMS to run this JavaScript code.

Configure Sitefinity CMS Tracking consent

To enable Sitefinity CMS to track user consent and configure it to hide the built-in consent dialog, perform the following:

  1. Use a text editor to create a new HTML file containing this HTML code:
  2. Save the file in your project’s ~/App_Data/Sitefinity/TrackingConsent/ folder as hideConsentDialog.html.
  3. In Sitefinity CMS backed, navigate to Administration » Settings » Tracking Consent.
  4. To configure consent tracking on all sites in your Sitefinity CMS instance, click Any domain.
    To configure a specific domain, click its name in the list.
  5. Select Ask users for consent to track their activities.
  6. Click Change.
    The Select a template dialog appears.
  7. Select the hideConsentDialog.html file.
  8. To save your changes, click Done » Done.

Create the JavaScript code

You also need to create custom JavaScript code that invokes the third-party tracking consent manager and synchronizes its user consent state with the built-in Sitefinity tracking consent functionality.

  1. Refer to the documentation of the third-party consent manager on how to programmatically show its UI to the site visitors and how to get their consent.
  2. To link the build-in and the 3rd party consent managers, you need to pass a Boolean value to the updateUserConsent() method. This enables the build-in Consent manager to set up all required cookies, reinitialize Sitefinity Insight tracking client, and enable or disable both server-side and client-side tracking. This sample code illustrates how to use Sitefinity CMS APIs:
  3. RECOMMENDATION: We recommend calling this script in the window’s load event to ensure it is always executed, even if your visitors reach pages through deep links. For more information, see EventTarget.addEventListener().

  4. Ensure that this JavaScript code is available on every page of your site. To do this, you use the JavaScript widget in your page templates. For more information, see JavaScript widget.

RECOMMENDATION: We recommend to not working directly with the Sitefinity Insight tracking implementation and cookie. Instead, use the existing Sitefinity CMS infrastructure to enable an easy upgrade to future versions of Sitefinity Insight.

Test the integration

To test that the integration works, perform the following:

  1. Start your browser’s private browsing mode.
  2. Browse a few pages and experiment with accepting and rejecting the Tracking consent.
  3. If the integration is successful and you have accepted the tracking, you can see the following cookies:
    • sf-tracking-consent with the value true
    • sf-data-intell-subject with a value that is kept when navigating the site and across browsing sessions (outside of Private browsing)
  4. If you reject tracking, you can see the following cookie:
    sf-tracking-consent with value false.


The third-party consent manager may have the functionality to classify cookies such as Security, Authorization, User preference, Marketing optimization, or Advertising and present the site users’ choice to accept only the cookies from some of these classes. If you want to use such granular control, you should mark the Sitefinity Insight cookie as a Marketing optimization cookie.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?