Initializes a new instance of the Tracker class.
The ID of the container to associate with the tracker.
Optional configuration for the tracker. Defaults to:
api_url: The API URL to use.auto_track_user_id: Specifies how to track the user ID (default is 'cookie').auto_track_session: Whether to automatically track the session ID (default is true).auto_track_referrer: Whether to automatically track the referrer (default is true).auto_track_url: Whether to automatically track the URL (default is true).Tracks an event by sending the event data to the specified API endpoint.
The name of the event to be tracked.
An object containing the data associated with the event.
The method performs the following steps:
eventData object to avoid mutating the original data.setEventDefaults.Pixel instance with the API URL, container ID, and debug options.Pixel instance.
The
Trackerclass is responsible for tracking events and sending them to a specified API endpoint. It provides functionality to automatically track user IDs, referrers, and URLs, as well as to set default values for event data.Remarks
This class is designed to be used in web applications where event tracking is required. It supports configuration options for customizing the tracking behavior.
Example