'consent' Method
Custom Intempt Method for Managing User Consent
The consent method is designed to record and manage user consent settings within an application. This functionality is essential for complying with data protection regulations and for maintaining user trust by respecting their privacy choices.
Usage example
const consentParams = {
action: 'agree',
validUntil: 1691823151, // Unix timestamp for consent expiry
email: '[email protected]',
message: 'User agreed to marketing emails.',
category: 'marketing'
};
intempt.consent(consentParams);
In this example, the consent method logs a user's agreement to receive marketing emails, specifying the duration of the consent and additional details about the consent given.
Declaration
The track method is declared as follows in TypeScript, showing that it does not produce a return value:
consent(params: ConsentParams): void
Params
The parameters for the consent method are specified in the ConsentParams
type, which supports comprehensive tracking of consent-related information:
type ConsentParams = {
action: ConsentAction, // The type of action taken (e.g., 'agree', 'decline').
validUntil: number, // Unix timestamp indicating when the consent expires.
email?: string, // Optional: User's email address, if applicable.
message?: string, // Optional: A message detailing the consent scenario.
category?: string // Optional: Category of consent (e.g., 'marketing', 'analytics').
}
Forbidden event names for use
Certain event names are reserved or forbidden to prevent conflicts or misidentification in the tracking system. They include common actions and default functionalities that are automatically tracked or handled differently:
- auto-track: Reserved for automatic tracking mechanisms.
- view page: Used specifically for page view tracking.
- leave page: Indicates a user leaving a page, automatically tracked.
- change on: Indicates a user leaving a page, automatically tracked.
- click on: Indicates a user leaving a page, automatically tracked.
- submit on: Used for tracking form submissions.
- identify: Special use within the identify function itself.
- consent: Special use within the identify function itself.
These names should not be used as custom event titles to avoid system errors and ensure accurate event categorization and analysis.
Updated about 3 hours ago