From dd26503f8c9afd6bb0df6340b088ffce8da4ee10 Mon Sep 17 00:00:00 2001 From: Matt Lane Date: Fri, 1 Mar 2019 11:47:08 -0800 Subject: [PATCH] Fix event firing on native click (#3589) --- src/native.js | 1 + src/secureCreatives.js | 4 +++- test/spec/native_spec.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/native.js b/src/native.js index f30df7e3ef7..8ebe4c8eca6 100644 --- a/src/native.js +++ b/src/native.js @@ -144,6 +144,7 @@ export function fireNativeTrackers(message, adObject) { } (trackers || []).forEach(triggerPixel); + return message.action; } /** diff --git a/src/secureCreatives.js b/src/secureCreatives.js index 3b5f6128ee9..8505923c493 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -52,7 +52,9 @@ function receiveMessage(ev) { return; } - fireNativeTrackers(data, adObject); + const trackerType = fireNativeTrackers(data, adObject); + if (trackerType === 'click') { return; } + auctionManager.addWinningBid(adObject); events.emit(BID_WON, adObject); } diff --git a/test/spec/native_spec.js b/test/spec/native_spec.js index d68d6c21958..ed21b5f681b 100644 --- a/test/spec/native_spec.js +++ b/test/spec/native_spec.js @@ -85,7 +85,8 @@ describe('native.js', function () { }); it('fires click trackers', function () { - fireNativeTrackers({ action: 'click' }, bid); + const trackerType = fireNativeTrackers({ action: 'click' }, bid); + expect(trackerType).to.equal('click'); sinon.assert.calledOnce(triggerPixelStub); sinon.assert.calledWith(triggerPixelStub, bid.native.clickTrackers[0]); });