Sending event on demand
Tracardi offers the flexibility to send events immediately when the fire parameter is set to true, enabling real-time event triggering and ensuring that data is captured and processed instantly. By default, events are queued and sent when the web page is fully rendered, which is beneficial for consolidating events and sending them as a single request. However, there are scenarios where sending events immediately upon certain actions, such as button clicks, is necessary. Sending Events in Real-Time
To send events in real-time, simply set the
fire parameter to
true when making API requests or using the Tracardi
This feature is particularly useful in scenarios where real-time data processing is critical, such as tracking user interactions, capturing user behavior, and implementing dynamic marketing strategies.
Example: Breaking the Event Queue
|Example where we break the event queue|
Forcing Profile ID
In certain situations, you may want to send a specific profile ID to Tracardi that comes from your backend system. To enable this feature, static ID must be enabled in the event source that collects data, and the profile ID must be added to the script configuration.
Here's an example:
It's important to note that this will send the provided profile ID regardless of whether a profile ID is already stored in the browser's local storage. If event source si not configured to allow static profile ID then System will try to load profile with provided ID - it will most probably fail and then it will generate the random ID. Please do not use this feature with events sources that has disabled static profile processing in events source.
Please be aware that sending a profile ID that's easy to guess can be a security risk. Attackers can potentially guess the ID and try to corrupt its data. Always use IDs like UUID4 to ensure security.
This feature is available from version 0.8.1 up.
Binding directly to Page Elements
Where the testClick function sends an event.
Please note that in this case, the event is recorded in the console but not sent to Tracardi by default.
To trigger the event and send it to Tracardi immediately, you can add the
fire attribute with a value of
true as a
parameter to the window.tracker.track function, as shown in the example below:
- This event will fire immediately.
The event "interest" will be sent immediately, because of