autotrackClick
Contents
Learn how to configure which click events Genesys Predictive Engagement tracks on your websites. This configuration provides more accurate page tracking information for use in segments and outcomes.
Description
The autotrackClick
module tracks when and where a visitor clicks on a webpage. To use autotrackClick
, configure the click events to track using the following options:
Signature
ac('load', 'autotrackClick', config, [callback]);
Example
ac('load', 'autotrackClick', {
clickEvents: [
{ selector: 'button.bg-green', eventName: 'green_button_clicked' },
{ selector: 'footer *', eventName: 'footer_clicked' }
]
}, function () {
console.log('"autotrackClick" has been loaded');
});
Config (required)
Description: Identifies an array of click events to track.
Type: Object
Properties: See the following table.
Name | Description | Type | Status |
---|---|---|---|
selector | String that selects elements. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches | String | required |
eventName | String used as the event name when an element matching the selector is clicked. | String | required |
customAttributes | Field used to send additional information when the selector is clicked. The field can be set with static, predetermined values. Once the autotrackClick module initiates, the value that is available in the value field is applied for the rest of the session. The value cannot be changed dynamically according to user action. There can be more than one field. |
Object | optional |
Example
To create an event to track the number of clicks on the green button, use the customAttributes as follows:{
clickEvents: [
{ selector: 'button.bg-green', eventName: 'green_button_clicked', customAttributes: {clickValue: 100, name: Insurance},
{ selector: 'footer *', eventName: 'footer_clicked' }
]
}
Use events to track outcome value
Use the attributes within the autotrackClick SDK to track an outcome from action maps. You can further use the value set within the SDK to the define the value of the outcome. In this example, the value of a click is set at 100. This means that if the value of the outcome stands at 1000, the total number of clicks is 10 with a total value of 1000.
Callback (optional)
When a module loads, callback is executed. No arguments pass to the callback.