Integrate This Code When Users Click A Link - AFS

AFS Integration Guide

Reference Guide

Common AFS click integration consists of tracking users when they click a search result. This example assumes links to results are done with an a HTML element such as the following one:

<a href="">Result label</a>

The objective is to call the provided click function when the link receives a mousedown event.

The mousedown event does not ensure the mouse button will be released over this link. If it is not the case, the browser will not go to the link target and click will have been tracked. Indeed, browsers listen to click event and not the mousedown event to process page change. But some browsers such as Chrome do not allow to execute some code when a link is clicked: they directly process to the redirection. In this case, click tracking does not work.