Skip to content

Commit

Permalink
improve robustness on OnEvent fields (prebid#6384)
Browse files Browse the repository at this point in the history
  • Loading branch information
guiann authored and seergiioo6 committed Mar 23, 2021
1 parent 1b0d7b8 commit 8432c42
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,15 @@ function getNativeAssets(response, nativeConfig) {
native.clickUrl = adJson.TrackingPrefix + '/ar?event_kind=CLICK&attempt=' + adJson.Attempt +
'&campaign=' + adJson.Campaign + '&url=' + encodeURIComponent(adJson.Content.Landing.Url);

native.clickTrackers = getTrackers(adJson.OnEvents['CLICK']);
native.impressionTrackers = getTrackers(adJson.OnEvents['IMPRESSION']);
if (adJson.OnEvents) {
native.clickTrackers = getTrackers(adJson.OnEvents['CLICK']);
native.impressionTrackers = getTrackers(adJson.OnEvents['IMPRESSION']);
native.javascriptTrackers = getTrackers(adJson.OnEvents['IMPRESSION'], true);
} else {
native.impressionTrackers = [];
}

native.impressionTrackers.push(impressionUrl);
native.javascriptTrackers = getTrackers(adJson.OnEvents['IMPRESSION'], true);
}

Object.keys(nativeConfig).map(function(key, index) {
Expand Down

0 comments on commit 8432c42

Please sign in to comment.