Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for so that the impressionTrackers and jsTrackers are called once per adElement #71

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/nativeTrackerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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) {
Expand Down