If you are tracking our recommendations built from backend model queries, then you don't need to run the track
function in the callback to register
. Just run the track
function by itself on the page.
$p('track', {
// track LI recommendations
elements: document.querySelectorAll('#li-recommendation-unit > div.recommended_item'),
name: 'default-widget',
source: 'LI',
_debug : true // Optional: show alerts on click or visible events (to know that the integration is working); ***remove prior to launch***
});
Note that elements
field is the list of elements that contains the recommendation. Our tracking function identifies all the anchors within specified DOM and attaches listeners that will tell us what kind of recommendations the user have viewed, and take feedback from every click they make on them.
Source is the name of the algorithm that was used to create recommendation. For A/B testing, we use default name 'LI' for LiftIgniter and 'base' for your own algorithm. Any other name will be logged to our system. But won't be rendered instantly on the board until it is registered.
For more details, see our technical documentation on the track function.
Keep in mind that Load order issues can get in the way of successful tracking. So make sure this tracking code is executed after the relevant selectors have been loaded into the page.