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

27th March 18: Merging Prebid Master into fork branch #18

Merged
merged 210 commits into from
Mar 27, 2018
Merged
Changes from 1 commit
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
93d33ca
Added YIELDONE Bid Adapter for Prebid.js 1.0 (#1900)
Dec 12, 2017
5fe1105
Add user-facing docs reminder to PR template (#1956)
rmloveland Dec 14, 2017
91bdce6
allow non-mappable sizes to be passed and used in rubicon adapter (#1…
snapwich Dec 15, 2017
bf3242b
Typo correction of YIELDONE md file (#1954)
Dec 19, 2017
6b21369
Serverbid bid adapter: update alias config (#1963)
jgrimes Dec 19, 2017
a936adb
use auctionId instead of requestId (#1968)
jaiminpanchal27 Dec 19, 2017
4bb4aaa
Add freewheel ssp bidder adapter for prebid 1.0 (#1793)
guillaume-sticky Dec 19, 2017
b738584
+ fixed endpoint request data property names - width to w and height …
optimatic58 Dec 19, 2017
f1f18e1
Added iQM Bid Adapter for Prebid.js 1.0 (#1880)
pkthakkar26 Dec 19, 2017
437cb05
Remove stray console.log (#1975)
matthewlane Dec 19, 2017
d4e1e98
Remove duplicate request id and fix empty response from getHighesCpmB…
jaiminpanchal27 Dec 19, 2017
778c496
[Add BidAdapter] rxrtb adapter for Perbid.js 1.0 (#1950)
prebidRxRTB Dec 19, 2017
68e08b1
ServerBid Server BidAdapter (#1819)
jcswart Dec 19, 2017
b7d5da3
added hb_source to default keys (#1969)
Dec 19, 2017
46cdaa1
Prebid 1.1.0 Release
matthewlane Dec 20, 2017
61f0414
Increment pre version
matthewlane Dec 20, 2017
d784396
S2s defaults fix in serverbidServerBidAdapter (#1986)
jaiminpanchal27 Dec 20, 2017
94cce25
remove hardcoded localhost port for tests (#1988)
snapwich Dec 20, 2017
60b9ac5
Fixes unit tests in browsers other than chrome (#1987)
jaiminpanchal27 Dec 20, 2017
ff8f539
Prebid 1.1.1 Release
jaiminpanchal27 Dec 20, 2017
2b1b1fe
Add note about docs needed before merge (#1959)
Jan 2, 2018
402877a
Adding optional width and height to display parameters (#1998)
nissSK Jan 3, 2018
30dddf8
TrustX adapter update (#1979)
PWyrembak Jan 3, 2018
46dfc43
Serverbid Bid Adapter: Add new ad sizes (#1983)
jgrimes Jan 3, 2018
569a3d1
Added dynamic ttl property for One Display and One Mobile. (#2004)
vzhukovsky Jan 4, 2018
8e3047b
pin gulp-connect at non-broken version (#2008)
snapwich Jan 4, 2018
be43c55
Gjirafa Bidder Adapter (#1944)
agon-qurdina Jan 4, 2018
87ae6ce
multiformat size validation checks (#1964)
jsnellbaker Jan 5, 2018
00e8e92
Upgrade Admixer adapter for Prebid 1.0 (#1755)
Galphimbl Jan 8, 2018
9f3f16f
Update Adform adapter to Prebid v1.0 (#1947)
Pupis Jan 10, 2018
6414a1f
Add NasmediaAdmixer adapter for Perbid.js 1.0 (#1937)
NasmediaWebtech Jan 10, 2018
3502919
Re-implemented RhythmOne audit beacon in prebid 1.0 interface (#1953)
jstocker76 Jan 10, 2018
289cee2
Fix uncached video bids triggering callback early (#2017)
matthewlane Jan 10, 2018
a5f059b
Use sudo to workaround Travis regression (#2041)
Jan 17, 2018
108f600
Adding districtm as an alias (#2018)
stevealliance Jan 17, 2018
4418fec
Serverbid Bid Adapter: updated docs and ad sizes (#2023)
jgrimes Jan 17, 2018
f09865b
GumGum Adapter for Prebid.js 1.0 (#1966)
mxcoder Jan 18, 2018
1e8155b
Media.net adapter added (#2038)
vedantseta Jan 22, 2018
25f1e5a
1.0 adapter support for mantis (#1840)
parisholley Jan 22, 2018
c58a158
Separate bids & won calls (#2015)
Yann-Pravo Jan 22, 2018
1b20a1c
OpenX Adapter: Update to support mediaTypes field, instead of the dep…
lntho Jan 22, 2018
c1d86ea
Add eplanningBidAdapter (#2003)
Nistenf Jan 22, 2018
6456959
Add vi bid adapter (#2020)
SnoopInf Jan 22, 2018
ecc34b6
Update Atomx adapter for Prebid v1.0 (#2026)
erikdubbelboer Jan 22, 2018
a264553
PubMatic 1.0 adapter (#2011)
PubMatic-OpenWrap Jan 23, 2018
9b56b11
Update adapter to prebid v1.0 (#1908)
Spacedragoon Jan 23, 2018
8907cae
InSkin Bidder Adapter (#2016)
jgrimes Jan 23, 2018
6cfaa5c
Colossus SSP header bidding adapter 1.0.0 (#2029)
Jan 23, 2018
e4eee81
pre1api module that allows use of deprecated pre1.0 API in Prebid 1.0…
snapwich Jan 23, 2018
24033ff
Support multiple media formats within a single ad unit (#1991)
matthewlane Jan 23, 2018
e39c58e
Fix skipped test (#2059)
matthewlane Jan 23, 2018
8b23ca1
Use cross-browser integer check (#2058)
matthewlane Jan 23, 2018
2eb8cdb
Optimera Adapter for 1.0. (#1961)
mcallari Jan 23, 2018
3e6f0fb
RockYou Adapter: Added RockYou Adapter supporting Prebid 1.0 (#1977)
cameronhotchkies Jan 23, 2018
261b9b4
Use polyfilled includes method (#2061)
matthewlane Jan 23, 2018
65c76ef
Prebid 1.2.0 Release
matthewlane Jan 23, 2018
c9af917
Increment pre version
matthewlane Jan 24, 2018
aa0bee7
Add display support for Vertamedia Adapter (#1945)
Millerrok Jan 24, 2018
f838057
Add video cache key (#2064)
moonshells Jan 25, 2018
548fce2
native is reserved keyword, use bracket/quotes to reference property …
kitwestneat Jan 25, 2018
104376b
Add Yieldlab adapter (#1967)
GEMI Jan 25, 2018
70781c9
Vidazoo bid adapter (#1916)
thewizarodofoz Jan 25, 2018
e818c6c
Add automatad alais to serverbid adapter. (#2062)
jcswart Jan 25, 2018
a534e0f
uncommenting utils_spec cookie tests, because no longer supporting IE…
harpere Jan 26, 2018
e14c719
Engine base url changed (#2072)
rade-popovic Jan 26, 2018
c449aec
C1X adapter updated to Prebid v1.0 (#1946)
CathyHuangtw Jan 30, 2018
40627d7
Add AdgenerationBidAdapter (#2034)
adg-dev Jan 30, 2018
017add7
Read secure fields to send requests (#2078)
Jan 30, 2018
9688c03
Support setting outstream renderer options (#2025)
matthewlane Jan 31, 2018
c654ebc
Yieldmo Bid Adapter Update (#2054)
MelodyLi2017 Jan 31, 2018
93ce52f
Added support for ad server currency; added ad unit sizes in test req…
jbartek25 Jan 31, 2018
06e916f
Make Bid Adapter for Dentsu Aegis Network Marketplace (#1982)
danmarketplace Feb 1, 2018
301cf31
Platform.io Bidder Adapter update. Support Native Ads. (#2009)
varashellov Feb 2, 2018
a35780d
Xendiz bid adapter (#1985)
Feb 2, 2018
0b98a8c
Bugfix - interpretResponse (#2082)
rade-popovic Feb 2, 2018
1c09041
Add support for mixed errors/bids response (#2052)
lovell Feb 2, 2018
2c7f7ed
pass empty responses array for registerSyncs in prebidserverBidAdapte…
snapwich Feb 2, 2018
d7c9350
Update ucfunnelBidAdapter (#1990)
RyanChouTw Feb 2, 2018
8a50184
Serverbid server optimization (#2048)
jcswart Feb 2, 2018
8b9c20b
Update vidazooBidAdapter.js (#2076)
thewizarodofoz Feb 2, 2018
9f412aa
add digitrust support to prebidserverBidAdapter (#2075)
snapwich Feb 2, 2018
7773f58
Pass app and device fields to Prebid server (#2044)
Feb 2, 2018
b69f351
Remove extraneous x. (#2096)
jcswart Feb 5, 2018
53ab63d
Adding Sonobi Bidder Adapter (#2033)
bansawbanchee Feb 5, 2018
77ad2f1
add peak adapter (#2040)
chanand Feb 5, 2018
5c37e60
Fix getUserSync test for ios (#2100)
MelodyLi2017 Feb 6, 2018
68b7d8b
PR / Issue Review process update (#2093)
bretg Feb 6, 2018
d48d7dd
Add hfa and pv parameter to request payload (#2109)
bansawbanchee Feb 6, 2018
16c9403
Serverbid Bid Adapter: getUserSyncs and new adsizes (#2106)
jgrimes Feb 6, 2018
8608201
Update adform adapter request (#2107)
Pupis Feb 6, 2018
4c71e65
Port calling order fix to 1.x (#2067)
kitwestneat Feb 6, 2018
aee2ef0
33across Bid Adapter: Bugfix + Refactor (#2024)
curlyblueeagle Feb 6, 2018
620ca80
removing userSync (#2032)
nissSK Feb 6, 2018
85e9451
adkernel adapter additional bid parameters (#2105)
ckbo3hrk Feb 6, 2018
3ca1693
must explicitly list pre1api for it to be included in build (#2097)
snapwich Feb 6, 2018
413abfb
Unit test fixes (#2111)
jaiminpanchal27 Feb 6, 2018
15ad83a
Prebid.js 1.3.0 Release
jaiminpanchal27 Feb 6, 2018
c053d04
Increment pre version
jaiminpanchal27 Feb 6, 2018
77fd5d2
Omit app and device if not present rather than send false (#2116)
snapwich Feb 7, 2018
1611159
Prebid 1.3.1 Release
jaiminpanchal27 Feb 7, 2018
63f9411
Increment pre version
jaiminpanchal27 Feb 7, 2018
f73db9e
fix bug where hooked functions w/ no hooks weren't ran immediately (#…
snapwich Feb 8, 2018
8bd9595
Added support for NURL and ADM as backup (#2112)
optimatic58 Feb 8, 2018
7e1abbe
Fix sovrn dealid (#2119)
Feb 8, 2018
ace5903
Add adapter for IAS (#2056)
katzhang-ias Feb 8, 2018
cfe1f72
Replace event string with constant (#2128)
matthewlane Feb 9, 2018
c31cc52
Update maintainer email (#2132)
MelodyLi2017 Feb 9, 2018
a2741f0
Add adapter for GAMMA SSP (#2092)
gammassp Feb 12, 2018
ef4354b
Remove unneeded lint exceptions (#2129)
matthewlane Feb 12, 2018
b16071c
Option to use a configurable vendor preset for s2sConfig (#2073)
jsnellbaker Feb 12, 2018
0923c91
remote.html is being deprecated in AMP. Pointer to the Prebid Server …
hhhjort Feb 12, 2018
1899a2b
Remove deprecated method reference (#2130)
matthewlane Feb 12, 2018
dab30a3
fix bug with privateSizes (#2141)
Feb 13, 2018
64bc038
added advertiserId and networkId for rubiconBidAdapter (#2086)
snapwich Feb 13, 2018
9cb9f2a
Update test stack POC (#2014)
jaiminpanchal27 Feb 13, 2018
2973f76
size mapping throws warning if mediaQuery missing (#2114)
snapwich Feb 14, 2018
f4fd825
Add package-lock.json for node v9 builds (#2144)
snapwich Feb 14, 2018
45154a0
AOL adapter: Fixed broken user matching in iframes (#2125)
vzhukovsky Feb 15, 2018
3b7c0ef
Fix bug in UndertoneBidAdapter (#2027)
omerko Feb 15, 2018
e44b108
Update to sovrn custom params as well as site object construction (#…
aprakash-sovrn Feb 15, 2018
2acd3c5
Update AdGeneration native impression trackers (#2151)
banakemi Feb 15, 2018
c38e9a2
Update PR_REVIEW.md
harpere Feb 15, 2018
513b89c
consolidated referrer logic and added pageUrl support from config in …
snapwich Feb 15, 2018
178955e
Fix stub syntax to work with test stack update (#2153)
matthewlane Feb 15, 2018
1b2475e
Add debug info to DOM for prebid creatives (#2158)
Feb 16, 2018
2d1d0e0
Adding Orbitsoft module for Prebid 1.0 (#2108)
Indra-sensei Feb 16, 2018
c6f448b
Add Publisher Common ID module (#2150)
pycnvr Feb 20, 2018
de9c345
added currency.defaultRates to use when currency file fails to load (…
snapwich Feb 20, 2018
5c025a1
Fix bidfloor param check in rxrtb adapter (#2157)
prebidRxRTB Feb 20, 2018
a455757
Add support for OpenRTB protocol and endpoint (#2102)
matthewlane Feb 20, 2018
4bfc941
Prebid 1.4.0 Release
jsnellbaker Feb 20, 2018
d131109
Update appnexusBidAdapter so clients can distinguish between managed …
jmfbird Feb 20, 2018
1d76429
Increment pre version
jsnellbaker Feb 20, 2018
853a762
Quantum Advertising Adapter (#2051)
sami-elasticad Feb 22, 2018
448d4db
only do video caching if we don't already have a videoCacheKey (#2143)
snapwich Feb 22, 2018
32dccd4
Update NasmediaAdmixer adapter (#2164)
NasmediaWebtech Feb 22, 2018
2775840
[Edit BidAdapter] rxrtb adapter for Perbid.js 1.0 (#2182)
prebidRxRTB Feb 22, 2018
31b0e92
only count bid timeouts if bidder didn't call done. fixes #2146 (#2154)
snapwich Feb 23, 2018
737ca04
Change bidderCode for DAN Marketplace Bid Adapter (#2183)
danmarketplace Feb 23, 2018
0ddebdf
Update Adyoulike Adapter to prebid 1.0 (#2077)
Feb 23, 2018
37ead27
Update Innity Adapter to Prebid.js v1.0 (#2180)
engtat Feb 23, 2018
324d530
[NEW Adapter] RTBHouseBidAdapter (#2184)
piwanczak Feb 23, 2018
fd7b24a
Add multiple bids request (#2136)
Millerrok Feb 23, 2018
9d55719
Update Vertoz adapter for Prebid 1.0 (#2104)
mohit546 Feb 23, 2018
c0ff4af
AdGeneration bugfix (#2191)
banakemi Feb 28, 2018
f169a85
RockYou Adapter: Update for multiple ad unit support (#2198)
cameronhotchkies Feb 28, 2018
1a3eeee
when position is not available, use "unknown" as the default position…
moonshells Mar 1, 2018
f40508c
ADSS-169 (#2187)
bruscantini Mar 2, 2018
cf13cc5
AT-5462 (#2188)
bruscantini Mar 2, 2018
dfc3c8f
Yieldbot Prebid.js 1.0 adapter (#2135)
elljoh Mar 2, 2018
bc9c29b
Remove bracket and object spacing lint exceptions (#2168)
matthewlane Mar 2, 2018
240fa95
VAST support in adform adapter (#2173)
braizhas Mar 2, 2018
c1d368b
Fix lint error (#2208)
matthewlane Mar 2, 2018
f7ee794
fix mediaType being overwritten by undefined in rubicon bid adapter (…
snapwich Mar 2, 2018
c92a590
Auctionmanager spec refactor pr (#2155)
kitwestneat Mar 2, 2018
95fe0a5
Update position default value in rubicon (#2214)
moonshells Mar 2, 2018
c54a179
Audience Network: allow native bids for non-IAB sizes (#2203)
lovell Mar 6, 2018
b82f852
Smartyads Adapter 1.x (#2080)
isss1650 Mar 6, 2018
ae341f9
Add banner support to Beachfront adapter (#2117)
jsalis Mar 6, 2018
355a6bf
Add FairTrade Bid Adapter (#2147)
VaticSSP Mar 6, 2018
fa55342
Adding PR_REVIEW guideline (#2159)
bretg Mar 6, 2018
1454f2b
33Across Bid Adapter: updated user sync endpoint (#2193)
curlyblueeagle Mar 6, 2018
b315a52
Feature/stale bot (#2192)
Mar 6, 2018
94c4023
Gamma Support UserSync Endpoint (#2216)
gammassp Mar 6, 2018
2204cf8
InSkin Bid Adapter: remove referrer field from request body (#2217)
jgrimes Mar 6, 2018
5232bc2
Update Vidazoo domain (#2223)
thewizarodofoz Mar 6, 2018
7904c5b
Add vuble adapter (#2201)
Roffray Mar 6, 2018
768cb62
Fix uncahced video bids from multi-response array triggering callback…
matthewlane Mar 6, 2018
04cca6e
Fix cross-platform test failures (#2228)
matthewlane Mar 6, 2018
f7b7521
Prebid 1.5.0 Release
matthewlane Mar 7, 2018
02ebe3a
Increment pre version
matthewlane Mar 7, 2018
b0260d5
Add Invibes Adapter (#2202)
rcheptanariu Mar 7, 2018
3cf7395
Fix #2229 - Edge cookie string form (#2236)
elljoh Mar 7, 2018
8f20009
PBS adapter not sending app or device (#2206)
Mar 8, 2018
f7813d5
Update Lifestreet adapter to 1.0 (#2197)
Lifestreet Mar 8, 2018
5486b63
Update Platform.io Adapter (#2230)
varashellov Mar 12, 2018
205b926
create RELEASE_SCHEDULE.md (#2255)
bretg Mar 12, 2018
58a5af0
use b64EncodeUnicode to encode strings with unicode chars in them (#2…
lestopher Mar 13, 2018
dfcae6b
Fix: add mediatype in bid response (#2260)
Roffray Mar 13, 2018
3b26c3a
Add billing url (burl) support (#2246)
matthewlane Mar 13, 2018
6ddbfd0
Added ad id to a4g bid (#2250)
adilets Mar 13, 2018
cd050b6
vastUrl is set based on nurl for video. (#2249)
muncha Mar 13, 2018
4fee47d
Updated adUnitCode (#2262)
adilets Mar 14, 2018
5ed5dcd
update params for test bid (#2267)
Millerrok Mar 15, 2018
2f6076e
Add vastUrl for Gamma Adapter Video (#2261)
gammassp Mar 15, 2018
717b439
Add e-planning analytics adapter (#2211)
matimar Mar 15, 2018
7d10bc7
Audience Network: Add 'pbv' and 'cb' query params (#2252)
lovell Mar 17, 2018
1c862a8
Updated Bid params (#2275)
adilets Mar 19, 2018
3e7df0d
Yieldbot impression image creation fix (#2277)
elljoh Mar 19, 2018
292b554
message formatting (#2285)
vedantseta Mar 19, 2018
6aa8c18
Update to Rubicon Adapter for mediaTypes support (#2272)
idettman Mar 19, 2018
b9906c3
Update for Media.net adapter (#2232)
vedantseta Mar 19, 2018
6382fe6
Update Yieldlab adapter and add official maintainer (#2231)
mirkorean Mar 19, 2018
c314596
add hb_cache_id, hb_uuid should be deprecated and replaced by hb_cach…
moonshells Mar 19, 2018
28e58ff
Add Content Ignite adapter (#2268)
jdrucey Mar 19, 2018
a577521
firing new adRenderFailed event when renderAd() fails (#2210)
vedantseta Mar 20, 2018
6ab7b54
Add Oneplanetonly Bid Adapter (#2269)
marliotto Mar 20, 2018
4fbf447
PBS videoCacheKey and vastUrl (#2101)
moonshells Mar 20, 2018
8aec362
Unit test fixes (#2301)
jaiminpanchal27 Mar 20, 2018
b8bdfec
Prebid 1.6.0 Release
jaiminpanchal27 Mar 20, 2018
07821c7
Increment Pre Version
jaiminpanchal27 Mar 20, 2018
4226643
add optional param to bridgewellBidAdapter (#2289)
wuleo Mar 21, 2018
57e2480
NEW adapter AdtelligentBidAdapter (#2137)
Millerrok Mar 22, 2018
8719aef
Smart Ad Server: Fix bug when multi bids (#2170)
Spacedragoon Mar 23, 2018
85cdf7b
Serverbid Bid Adapter: Added archon alias (#2293)
jgrimes Mar 26, 2018
4012c7e
if cache markup is not enabled, set it to the default value 0 (#2302)
moonshells Mar 26, 2018
63159da
Enhance location detection within utils (#2167)
Mar 26, 2018
bae04f4
Update stalebot labels (#2319)
matthewlane Mar 26, 2018
469d586
Changing default currency file to https (#2306)
bretg Mar 26, 2018
feafdcf
Support aliases in prebidServer (#2257)
matthewlane Mar 26, 2018
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
Prev Previous commit
Next Next commit
firing new adRenderFailed event when renderAd() fails (prebid#2210)
* firing adRenderFailed when ad render fails

* test case added

* refactored adRenderFail event

* Condition changed
  • Loading branch information
vedantseta authored and jsnellbaker committed Mar 20, 2018
commit a5775216020509a979750af76092687fd0644bda
2 changes: 2 additions & 0 deletions src/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ const BID_RESPONSE = CONSTANTS.EVENTS.BID_RESPONSE;
const BID_WON = CONSTANTS.EVENTS.BID_WON;
const BID_ADJUSTMENT = CONSTANTS.EVENTS.BID_ADJUSTMENT;
const SET_TARGETING = CONSTANTS.EVENTS.SET_TARGETING;
const AD_RENDER_FAILED = CONSTANTS.EVENTS.AD_RENDER_FAILED;

const LIBRARY = 'library';
const ENDPOINT = 'endpoint';
@@ -105,6 +106,7 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler }
[BID_ADJUSTMENT]: args => this.enqueue({ eventType: BID_ADJUSTMENT, args }),
[SET_TARGETING]: args => this.enqueue({ eventType: SET_TARGETING, args }),
[AUCTION_END]: args => this.enqueue({ eventType: AUCTION_END, args }),
[AD_RENDER_FAILED]: args => this.enqueue({ eventType: AD_RENDER_FAILED, args }),
[AUCTION_INIT]: args => {
args.config = config.options; // enableAnaltyics configuration object
this.enqueue({ eventType: AUCTION_INIT, args });
10 changes: 9 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
@@ -33,7 +33,15 @@
"BID_WON": "bidWon",
"SET_TARGETING": "setTargeting",
"REQUEST_BIDS": "requestBids",
"ADD_AD_UNITS": "addAdUnits"
"ADD_AD_UNITS": "addAdUnits",
"AD_RENDER_FAILED" : "adRenderFailed"
},
"AD_RENDER_FAILED_REASON" : {
"PREVENT_WRITING_ON_MAIN_DOCUMENT": "preventWritingOnMainDocuemnt",
"NO_AD": "noAd",
"EXCEPTION": "exception",
"CANNOT_FIND_AD": "cannotFindAd",
"MISSING_DOC_OR_ADID": "missingDocOrAdid"
},
"EVENT_ID_PATHS": {
"bidWon": "adUnitCode"
31 changes: 25 additions & 6 deletions src/prebid.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@ const { triggerUserSyncs } = userSync;
/* private variables */

const RENDERED = 'rendered';
const { ADD_AD_UNITS, BID_WON, REQUEST_BIDS, SET_TARGETING } = CONSTANTS.EVENTS;
const { ADD_AD_UNITS, BID_WON, REQUEST_BIDS, SET_TARGETING, AD_RENDER_FAILED } = CONSTANTS.EVENTS;
const { PREVENT_WRITING_ON_MAIN_DOCUMENT, NO_AD, EXCEPTION, CANNOT_FIND_AD, MISSING_DOC_OR_ADID } = CONSTANTS.AD_RENDER_FAILED_REASON;

var eventValidators = {
bidWon: checkDefinedPlacement
@@ -196,6 +197,18 @@ $$PREBID_GLOBAL$$.setTargetingForAst = function() {
events.emit(SET_TARGETING);
};

function emitAdRenderFail(reason, message, bid) {
const data = {};

data.reason = reason;
data.message = message;
if (bid) {
data.bid = bid;
}

utils.logError(message);
events.emit(AD_RENDER_FAILED, data);
}
/**
* This function will render the ad (based on params) in the given iframe document passed through.
* Note that doc SHOULD NOT be the parent document page as we can't doc.write() asynchronously
@@ -206,6 +219,7 @@ $$PREBID_GLOBAL$$.setTargetingForAst = function() {
$$PREBID_GLOBAL$$.renderAd = function (doc, id) {
utils.logInfo('Invoking $$PREBID_GLOBAL$$.renderAd', arguments);
utils.logMessage('Calling renderAd with adId :' + id);

if (doc && id) {
try {
// lookup ad by ad Id
@@ -229,7 +243,8 @@ $$PREBID_GLOBAL$$.renderAd = function (doc, id) {
if (renderer && renderer.url) {
renderer.render(bid);
} else if ((doc === document && !utils.inIframe()) || mediaType === 'video') {
utils.logError(`Error trying to write ad. Ad render call ad id ${id} was prevented from writing to the main document.`);
const message = `Error trying to write ad. Ad render call ad id ${id} was prevented from writing to the main document.`;
emitAdRenderFail(PREVENT_WRITING_ON_MAIN_DOCUMENT, message, bid);
} else if (ad) {
doc.write(ad);
doc.close();
@@ -247,16 +262,20 @@ $$PREBID_GLOBAL$$.renderAd = function (doc, id) {
setRenderSize(doc, width, height);
utils.callBurl(bid);
} else {
utils.logError('Error trying to write ad. No ad for bid response id: ' + id);
const message = `Error trying to write ad. No ad for bid response id: ${id}`;
emitAdRenderFail(NO_AD, message, bid);
}
} else {
utils.logError('Error trying to write ad. Cannot find ad by given id : ' + id);
const message = `Error trying to write ad. Cannot find ad by given id : ${id}`;
emitAdRenderFail(CANNOT_FIND_AD, message);
}
} catch (e) {
utils.logError('Error trying to write ad Id :' + id + ' to the page:' + e.message);
const message = `Error trying to write ad Id :${id} to the page:${e.message}`;
emitAdRenderFail(EXCEPTION, message);
}
} else {
utils.logError('Error trying to write ad Id :' + id + ' to the page. Missing document or adId');
const message = `Error trying to write ad Id :${id} to the page. Missing document or adId`;
emitAdRenderFail(MISSING_DOC_OR_ADID, message);
}
};

13 changes: 13 additions & 0 deletions test/spec/AnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ const BID_REQUESTED = CONSTANTS.EVENTS.BID_REQUESTED;
const BID_RESPONSE = CONSTANTS.EVENTS.BID_RESPONSE;
const BID_WON = CONSTANTS.EVENTS.BID_WON;
const BID_TIMEOUT = CONSTANTS.EVENTS.BID_TIMEOUT;
const AD_RENDER_FAILED = CONSTANTS.EVENTS.AD_RENDER_FAILED;

const AnalyticsAdapter = require('src/AnalyticsAdapter').default;
const config = {
url: 'http://localhost:9999/src/adapters/analytics/libraries/example.js',
@@ -90,6 +92,17 @@ FEATURE: Analytics Adapters API
assert.deepEqual(spyTestGlobal.args[0][2], args, `with expected event data\n`);
});

it('SHOULD call global when a adRenderFailed event occurs', () => {
const eventType = AD_RENDER_FAILED;
const args = { call: 'adRenderFailed' };

adapter.enableAnalytics();
events.emit(eventType, args);

assert.ok(spyTestGlobal.args[0][1] === eventType, `with expected event type\n`);
assert.deepEqual(spyTestGlobal.args[0][2], args, `with expected event data\n`);
});

it('SHOULD call global when a bidRequest event occurs', () => {
const eventType = BID_REQUESTED;
const args = { call: 'request' };