'record' Method
Custom Intempt Method for Detailed Event and Interaction Tracking
The record method is designed to comprehensively log detailed events and interactions within an application. This method is pivotal for collecting a wide range of user and account-specific information, ensuring that data is only recorded following user consent and parameter validation.
Usage example
const recordParams = {
eventTitle: 'User Login',
userId: 'user123',
userAttributes: {
loginMethod: 'email',
loginStatus: 'success'
},
data: {
ipAddress: '192.168.1.1'
}
};
intempt.record(recordParams);
In this example, the record method logs a user login event with detailed attributes about the user and additional data such as the IP address from which the login was made.
Declaration
The record method is declared as follows in TypeScript, signifying that it does not return any output:
record(params: RecordParams): void
Params
The parameters for the record method are defined within the RecordParams
type, which supports detailed tracking and rich data collection:
type RecordParams = {
eventTitle: string, // Mandatory title of the event.
accountId?: string, // Optional account ID involved in the event.
userId?: string, // Optional user ID related to the event.
accountAttributes?: {[key:string]: any}, // Optional attributes associated with the account.
userAttributes?: {[key:string]: any}, // Optional attributes specific to the user.
data?: {[key:string]: any} // Optional additional data relevant to the event.
}
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