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 Modify the appearance of the consent dialog.

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

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?