Tracked Event Integration Methods
DXA JavaScript API call
Enabling DXA JavaScript API call
When adding or editing a tracked event, in the Integration method dropdown menu, select Decibel JavaScript API call.
Implementing the tracked event integration code
-
On the navigation bar, go to Define > Tracked Events > View.
The tracked event settings screen appears.
-
On the tracked event settings screen table, in the Actions column, click Show integration code for the tracked event you want to implement.
The tracked event integration code appears in a text box.
-
Copy the tracked event integration code.
-
Implement the integration code using a tag manager or directly in the page code.
The tracked event is implemented.
Adding value to a tracked event
JavaScript on-click event
Enabling JavaScript on-click event
-
When adding or editing a tracked event, in the Integration method dropdown menu, select JavaScript On-click Event.
The Selector text box and search button appear.
-
In the Selector text box, point to the UI element you want to implement the tracked event on. The following options are available:Note: The Selector text box has a 200-character limit.
-
Manually enter a selector.
-
Use the search button to select a UI element
-
For more information on using the Selector text box to populate the UI element you want to implement the tracked event on, see the sections below.
Manually entering a selector
-
In the Selector text box, enter a selector. For example,
#checkout or div.product > .addToBasket
. -
Click Save Tracked Event.
The tracked event will be triggered when a visitor interacts with the selected UI element.
Selecting a UI element with the search button
- Ensure the page with the UI element you want to integrate the tracked event on is available as a tab on the same browser you use DXA.
-
To the right of the Selector text box, click the search button.
A dropdown menu appears listing names of the pages for your property currently available as tabs on your browser.
-
On the dropdown menu, click the name of the page you want to trigger the tracked event on.
The page you clicked opens in a new tab on the browser.
-
On the recently opened page, hover over the UI element you want to trigger the tracked event on.
In the image below, the element hovered over has the
ID h2.title
. The element title is contained within parentheses. -
Click the element you're hovering over.
The element HTML appears in the Selector text box. The element ID is the final entry in the text.
-
Click Save Tracked Event.
The tracked event will be triggered when a visitor interacts with the selected UI element.
Rules
Add rules to trigger tracked events when specific conditions are detected.