Skip to content

Commit

Permalink
track all pointer interactions, not just left clicks (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi authored Apr 23, 2024
1 parent 9b3c203 commit 3b68012
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/nativeORTBTrackerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function addNativeClickTrackers(adId, sendMessage) {
const adElements = document.getElementsByClassName(AD_ANCHOR_CLASS_NAME) || [];
// get all assets that have 'link' property, map asset.id -> asset.link
for (let i = 0; i < adElements.length; i++) {
adElements[i].addEventListener('click', (event) => {
adElements[i].addEventListener('pointerdown', (event) => {
let targetElement = event.target;
// check if clicked element is associated with any native asset (look for 'hb_native_asset_id' attribute)
let assetId = targetElement && targetElement.getAttribute(ASSET_ID_ELEMENT_ATTRIBUTE);
Expand Down
4 changes: 2 additions & 2 deletions src/nativeTrackerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function newNativeTrackerManager(win) {

for (let i = 0; i < adElements.length; i++) {
let adId = readAdIdFromSingleElement(adElements[i]);
adElements[i].addEventListener('click', function(event) {
adElements[i].addEventListener('pointerdown', function(event) {
listener(event, adId);
}, true);
}
Expand Down Expand Up @@ -83,7 +83,7 @@ export function newNativeTrackerManager(win) {
attachClickListeners(false, boundedLoadMobileClickTrackers);

(impTrackers || []).forEach(triggerPixel);

// fire impression IMG trackers
eventtrackers
.filter(tracker => tracker.event === 1 && tracker.method === 1)
Expand Down

0 comments on commit 3b68012

Please sign in to comment.