Integrate third-party Tracking consent manager
Overview
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:
- In Sitefinity CMS backed, navigate to Administration » Settings » Tracking Consent.
- 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.
- In Ask for user consent, select Yes.
- In Consent type, select External.
- 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.
- 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.
- 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:
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().
- 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.
Handle cookies
Tracking consent user choice is saved in a cookie named sf-tracking-consent
on the client’s browser. The cookie is set to true
when the user consents to tracking their behavior, and to false
when the user declines. This cookie is used by both Sitefinity CMS and Sitefinity Insight.
For more information, see Tracking consent.
If you are using third-party consent tracking, you need to ensure that you are properly managing this cookie to enable the proper functionality of Sitefinity Insight.
When integrating a third-party content tracking solution, you must ensure that the third-party solution handles this cookie and sets it to reflect the user consent correctly.
For an example how to use Google Tag Manger, see Configure Google Tag Manager to work with the Sitefinity tracking cookie.
Sitefinity CMS does not automatically delete the tracking cookies in the visitor’s browser. If the user does not consent to tracking, you must delete these cookies manually. For more information on how you do that, see
Manually delete tracking cookie.
Test the integration
To test that the integration works, perform the following:
- Start your browser’s private browsing mode.
- Browse a few pages and experiment with accepting and rejecting the Tracking consent.
- 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)
- If you reject tracking, you can see the following cookie:
sf-tracking-consent
with value false
.
Considerations
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.