From 396596e774a2b416453a69ec9eb1696852e34553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Mahe=CC=81?= Date: Mon, 6 May 2019 16:30:41 +0200 Subject: [PATCH] Fix for so that the impressionTrackers and javascriptTrackers are called once per adElement --- src/nativeTrackerManager.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/nativeTrackerManager.js b/src/nativeTrackerManager.js index 1142cbf9..f7f5ae03 100644 --- a/src/nativeTrackerManager.js +++ b/src/nativeTrackerManager.js @@ -23,6 +23,13 @@ export function newNativeTrackerManager(win) { return adId || ''; } + function readAdIdFromSingleElement(adElement) { + let adId = adElement.attributes && + adElement.attributes[AD_DATA_ADID_ATTRIBUTE] && + adElement.attributes[AD_DATA_ADID_ATTRIBUTE].value; + return adId || ''; + } + function readAdIdFromEvent(event) { let adId = event && @@ -40,8 +47,10 @@ export function newNativeTrackerManager(win) { } function loadImpTrackers(adElements) { - let adId = readAdIdFromElement(adElements); - fireTracker(adId, 'impression'); + for(var i = 0; i < adElements.length; i++){ + let adId = readAdIdFromSingleElement(adElements[i]); + fireTracker(adId, 'impression'); + } } function attachClickListeners(adElements) {