hasUserConsentedToSessionRecording()
function hasUserConsentedToSessionRecording(): boolean;
Determines whether the user has consented to session recording based on OneTrust configuration and other signals.
This function checks for user consent using multiple strategies, in the following order:
- If
window.emui.dangerouslyOverrideSessionRecordingConsentistrue, force consent ON (test/dev only). Any other value (false,undefined) defers to the normal sources below —falseis not a force-disable. - If OneTrust is loaded, checks if
window.OnetrustActiveGroupscontains the session recording group ID ('C0003'). - If OneTrust is not loaded, checks the
analyticsConsentquery parameter in the current URL. - If running in an iframe, checks the
analyticsConsentquery parameter in the iframe's src URL. - Defaults to
falseif no consent can be determined.
Note: When OneTrust is present, the OneTrust consent groups take precedence over URL parameters.
The analyticsConsent URL parameter only applies when OneTrust is not loaded.
Returns
boolean
true if the user has consented to session recording, false otherwise.