Tracking consent Client-side API

When you enable Tracking consent functionality, for every client page, Sitefinity CMS creates a global JavaScript object named TrackingConsentManager. The object is responsible for displaying a tracking consent dialog and storing user choice.

The TrackingConsentManager object has following methods:

  • Init
    Initializes the object by specifying template for consent dialog.
  • canTrackCurrentUser
    Returns true, if current user has provided consent, otherwise, returns false.
  • updateUserConsent 
    Updates the user consent. If this method is invoked with true, Sitefinity CMS considers that the user has provided consent for being tracked.
  • askForUserConsent 
    Initialized and displays the user consent dialog. 
  • addEventListener 
    Register event handler for a specific event.
  • removeEventListener
    Cleans up event handler for a specific event.

TrackingConsentManager triggers the following events:

  • AfterDialogDisplayed 
    Triggered right after consent dialog is added to the DOM.
  • BeforeDialogClosed 
    Triggered before consent dialog template is removed from the DOM.
  • ConsentChanged 
    Triggered when user consent is changed.
EXAMPLE: For examples of how to use these methods and events, see:

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?