User Consent and Tracking Methods

'optIn' Method

This method is used to enable tracking of user interactions within an application. It reverses any previous tracking restrictions set by the optOut method.

Usage example

intempt.optIn();

After this method is called, the application will begin to track user activities, assuming no other restrictions are in place.

Declaration

optIn(): void


'optOut' Method

This method disables the tracking of user interactions, ensuring that the user's actions are not monitored or recorded.

Usage example

intempt.optOut();

Calling this method will stop the tracking of user activities, adhering to privacy preferences or regulations.

Declaration

optOut(): void

'isUserOptIn' Method

This method checks whether the user has consented to tracking. It is primarily used to ensure compliance with user preferences before performing any tracking operations.

Usage example

if (intempt.isUserOptIn()) {
  console.log("Tracking is enabled.");
} else {
  console.log("Tracking is disabled.");
}

This example demonstrates how to verify if tracking is enabled before logging or collecting any data.

Declaration

isUserOptIn(): boolean

Returns

  • Boolean: Returns true if tracking is enabled (optIn has been called), and false if tracking is disabled (optOut has been called). The default state is set to true, indicating that tracking is enabled unless explicitly disabled.