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:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?