From 7a3889e2d2a4e778cc5ea564fc7fa0b78ff452af Mon Sep 17 00:00:00 2001 From: Andy Stocker Date: Tue, 18 Apr 2017 10:27:39 -0700 Subject: [PATCH 1/6] added audit beacon to detect misuse of this bidder. Detects auctions within iframes or popup windows. --- src/adapters/rhythmone.js | 90 ++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index 57b6e29a217..40937b5c02c 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -21,7 +21,10 @@ module.exports = function(bidManager, global, loader){ debug = false, auctionEnded = false, requestCompleted = false, - placementCodes = {}; + placementCodes = {}, + loadStart, + configuredPlacements = [], + fat = /(^v|(\.0)+$)/gi; if(typeof global === "undefined") global = window; @@ -169,12 +172,12 @@ module.exports = function(bidManager, global, loader){ var d = global.document.location.ancestorOrigins; if(d && d.length > 0) return d[d.length-1]; - return global.top.document.location.hostname; + return global.top.document.location.hostname; // try/catch is in the attempt function },"")); - p("title", attempt(function(){return global.top.document.title;},"")); + p("title", attempt(function(){return global.top.document.title;},"")); // try/catch is in the attempt function p("url", attempt(function(){ var l; - try{l = global.top.document.location.href.toString();} + try{l = global.top.document.location.href.toString();} // try/catch is in the attempt function catch(ex){l = global.document.location.href.toString();} return l; },"")); @@ -184,16 +187,16 @@ module.exports = function(bidManager, global, loader){ p("dtype", ((/(ios|ipod|ipad|iphone|android)/i).test(global.navigator.userAgent) ? 1 : ((/(smart[-]?tv|hbbtv|appletv|googletv|hdmi|netcast\.tv|viera|nettv|roku|\bdtv\b|sonydtv|inettvbrowser|\btv\b)/i).test(global.navigator.userAgent) ? 3 : 2))); p("flash", (flashInstalled() ? 1 : 0)); - var placementCodes = [], - heights = [], + var heights = [], widths = [], floors = [], mediaTypes = [], - fat = /(^v|(\.0)+$)/gi, i=0; + configuredPlacements = []; + p("hbv", global.$$PREBID_GLOBAL$$.version.replace(fat,"")+","+version.replace(fat,"")); - + for(; i 0) + data.ancestor_origins = ao[ao.length-1]; + + data.popped = (window.opener!==null?1:0); + data.framed = (window.top===window?0:1); + + try{ + data.url = window.top.document.location.href.toString(); + }catch(ex){ + data.url = window.document.location.href.toString(); + } + + var prebid_instance = global.$$PREBID_GLOBAL$$; + + data.prebid_version = prebid_instance.version.replace(fat,""); + data.response_ms = (new Date()).getTime() - loadStart; + data.placement_codes = configuredPlacements.join(","); + data.bidder_version = version; + data.prebid_timeout = (prebid_instance.cbTimeout || prebid_instance.bidderTimeout); + + for(var k in data) + q.push(encodeURIComponent(k)+"="+encodeURIComponent((typeof data[k] === "object" ? JSON.stringify(data[k]) : data[k]))); + + q.sort(); + + i.addEventListener("load", function(){ + console.log("beacon sent"); + }); + i.src = u+q.join("&"); + } + this.callBids = function(params){ var slotMap = {}, @@ -246,31 +291,26 @@ module.exports = function(bidManager, global, loader){ for(var i = 0; i Date: Tue, 18 Apr 2017 11:07:02 -0700 Subject: [PATCH 2/6] fix for bug #1123 - Rhythmone: Multiple requestBids Not Working. An auction ended flag was set, preventing additional auctions from completing. This has been removed along with some google analytics tracking code. --- src/adapters/rhythmone.js | 71 ++------------------------------------- 1 file changed, 3 insertions(+), 68 deletions(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index 40937b5c02c..9769c6fbf11 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -3,15 +3,6 @@ var bidmanager = require('../bidmanager.js'), CONSTANTS = require('../constants.json'); import {ajax as ajax} from '../ajax'; - -function track(debug) { - if(debug === true){ - //console.log('GA: %s %s %s', p1, p2, p3 || ''); - } -} - -var w = (typeof window !== "undefined" ? window : {}); -w.trackR1Impression = track; module.exports = function(bidManager, global, loader){ @@ -19,7 +10,6 @@ module.exports = function(bidManager, global, loader){ defaultZone = "1r", defaultPath = "mvo", debug = false, - auctionEnded = false, requestCompleted = false, placementCodes = {}, loadStart, @@ -74,8 +64,7 @@ module.exports = function(bidManager, global, loader){ return false; } - var bidderCode = "rhythmone", - bidLostTimeout = null; + var bidderCode = "rhythmone"; function attempt(valueFunction, defaultValue){ try{ @@ -89,34 +78,6 @@ module.exports = function(bidManager, global, loader){ console.log(txt); } - function sniffAuctionEnd(){ - - global.$$PREBID_GLOBAL$$.onEvent('bidWon', function (e) { - - if(e.bidderCode === bidderCode){ - placementCodes[e.adUnitCode] = true; - track(debug, 'hb', "bidWon"); - } - - if(auctionEnded){ - clearTimeout(bidLostTimeout); - bidLostTimeout = setTimeout(function(){ - for(var k in placementCodes) - if(placementCodes[k] === false) - track(debug, 'hb', "bidLost"); - }, 50); - } - }); - - global.$$PREBID_GLOBAL$$.onEvent('auctionEnd', function () { - - auctionEnded = true; - - if(requestCompleted === false) - track(debug, 'hb', 'rmpReplyFail', "prebid timeout post auction"); - }); - } - function getBidParameters(bids){ for(var i=0;i 0 && typeof bids[i].sizes[0] === "number") @@ -262,10 +221,6 @@ module.exports = function(bidManager, global, loader){ q.push(encodeURIComponent(k)+"="+encodeURIComponent((typeof data[k] === "object" ? JSON.stringify(data[k]) : data[k]))); q.sort(); - - i.addEventListener("load", function(){ - console.log("beacon sent"); - }); i.src = u+q.join("&"); } @@ -275,19 +230,12 @@ module.exports = function(bidManager, global, loader){ bidParams = getBidParameters(params.bids); debug = (bidParams !== null && bidParams.debug === true); - - track(debug, 'hb', 'callBids'); if(bidParams === null){ noBids(params); - track(debug, 'hb', 'misconfiguration'); return; } - sniffAuctionEnd(); - - track(debug, 'hb', 'rmpRequest'); - for(var i = 0; i Date: Tue, 25 Apr 2017 15:09:05 -0700 Subject: [PATCH 3/6] Altered the beacon logging domain to something with a functional SSL cert. --- src/adapters/rhythmone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index 9769c6fbf11..ec96b14d8e6 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -194,7 +194,7 @@ module.exports = function(bidManager, global, loader){ }, ao = document.location.ancestorOrigins, q = [], - u = "//te.renetl.com/hbperf?", + u = "//hbevents.1rx.io/hbperf?", i = new Image(); if(ao && ao.length > 0) From 1c3ae2d96410f6946c6959c79dac06cf2f975988 Mon Sep 17 00:00:00 2001 From: Andy Stocker Date: Wed, 26 Apr 2017 09:34:49 -0700 Subject: [PATCH 4/6] updating s3 bucket name --- src/adapters/rhythmone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index ec96b14d8e6..bfe2197d31e 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -194,7 +194,7 @@ module.exports = function(bidManager, global, loader){ }, ao = document.location.ancestorOrigins, q = [], - u = "//hbevents.1rx.io/hbperf?", + u = "//hbevents.1rx.io/hbaudit?", i = new Image(); if(ao && ao.length > 0) From fbabd87bc08e81c5a0afe51b7716f3064b5086e2 Mon Sep 17 00:00:00 2001 From: Andy Stocker Date: Wed, 26 Apr 2017 10:06:36 -0700 Subject: [PATCH 5/6] updating s3 bucket name _again_. --- src/adapters/rhythmone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index bfe2197d31e..64496f01c53 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -194,7 +194,7 @@ module.exports = function(bidManager, global, loader){ }, ao = document.location.ancestorOrigins, q = [], - u = "//hbevents.1rx.io/hbaudit?", + u = "//hbevents.1rx.io/audit?", i = new Image(); if(ao && ao.length > 0) From 7e55ad3a0a10468a3c8d953a2d153ce400de109e Mon Sep 17 00:00:00 2001 From: Andy Stocker Date: Fri, 28 Apr 2017 16:33:35 -0700 Subject: [PATCH 6/6] Adding optional curly braces. Removing optional parentheses. --- src/adapters/rhythmone.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/adapters/rhythmone.js b/src/adapters/rhythmone.js index 64496f01c53..9d24e9fac98 100644 --- a/src/adapters/rhythmone.js +++ b/src/adapters/rhythmone.js @@ -197,11 +197,12 @@ module.exports = function(bidManager, global, loader){ u = "//hbevents.1rx.io/audit?", i = new Image(); - if(ao && ao.length > 0) + if(ao && ao.length > 0){ data.ancestor_origins = ao[ao.length-1]; + } - data.popped = (window.opener!==null?1:0); - data.framed = (window.top===window?0:1); + data.popped = window.opener!==null?1:0; + data.framed = window.top===window?0:1; try{ data.url = window.top.document.location.href.toString(); @@ -215,10 +216,11 @@ module.exports = function(bidManager, global, loader){ data.response_ms = (new Date()).getTime() - loadStart; data.placement_codes = configuredPlacements.join(","); data.bidder_version = version; - data.prebid_timeout = (prebid_instance.cbTimeout || prebid_instance.bidderTimeout); + data.prebid_timeout = prebid_instance.cbTimeout || prebid_instance.bidderTimeout; - for(var k in data) + for(var k in data){ q.push(encodeURIComponent(k)+"="+encodeURIComponent((typeof data[k] === "object" ? JSON.stringify(data[k]) : data[k]))); + } q.sort(); i.src = u+q.join("&");