Skip to content

Commit

Permalink
Realvu adapter: Remove _ps in _f=conf request (prebid#3995)
Browse files Browse the repository at this point in the history
* Remove _ps in _f=conf request

* Replace "

* realvuAnalyticsAdapter_spec updated
  • Loading branch information
tchibirev authored and sa1omon committed Nov 28, 2019
1 parent 714b2e9 commit 59fdf0d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
36 changes: 18 additions & 18 deletions modules/realvuAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export let lib = {
let z = this;
let u = navigator.userAgent;
z.device = u.match(/iPad|Tablet/gi) ? 'tablet' : u.match(/iPhone|iPod|Android|Opera Mini|IEMobile/gi) ? 'mobile' : 'desktop';
if (typeof (z.len) == 'undefined') z.len = 0; // check, meybe too much, just make it len:0,
if (typeof (z.len) == 'undefined') z.len = 0;
z.ie = navigator.appVersion.match(/MSIE/);
z.saf = (u.match(/Safari/) && !u.match(/Chrome/));
z.ff = u.match(/Firefox/i);
Expand All @@ -54,21 +54,20 @@ export let lib = {
}
}
z.add_evt(window.top1, 'focus', function () {
window.top1.realvu_aa.foc = 1; /* window.top1.realvu_aa.log('focus',-1); */
window.top1.realvu_aa.foc = 1;
});
z.add_evt(window.top1, 'scroll', function () {
window.top1.realvu_aa.foc = 1;
});
// z.add_evt(window.top1, "scroll", function(){window.top1.realvu_aa.foc=1;window.top1.realvu_aa.log('scroll focus',-1);});
z.add_evt(window.top1, 'blur', function () {
window.top1.realvu_aa.foc = 0; /* window.top1.realvu_aa.log('blur',-1); */
window.top1.realvu_aa.foc = 0;
});
// + http://www.w3.org/TR/page-visibility/
z.add_evt(window.top1.document, 'blur', function () {
window.top1.realvu_aa.foc = 0; /* window.top1.realvu_aa.log('blur',-1); */
window.top1.realvu_aa.foc = 0;
});
z.add_evt(window.top1, 'visibilitychange', function () {
window.top1.realvu_aa.foc = !window.top1.document.hidden;
/* window.top1.realvu_aa.log('vis-ch '+window.top1.realvu_aa.foc,-1); */
});
// -
z.doLog = (window.top1.location.search.match(/boost_log/) || document.referrer.match(/boost_log/)) ? 1 : 0;
if (z.doLog) {
window.setTimeout(z.scr(window.top1.location.protocol + '//ac.realvu.net/realvu_aa_viz.js'), 500);
Expand All @@ -84,11 +83,12 @@ export let lib = {

update: function () {
let z = this;
let de = window.top1.document.documentElement;
z.x1 = window.top1.pageXOffset ? window.top1.pageXOffset : de.scrollLeft;
z.y1 = window.top1.pageYOffset ? window.top1.pageYOffset : de.scrollTop;
let w1 = window.top1.innerWidth ? window.top1.innerWidth : de.clientWidth;
let h1 = window.top1.innerHeight ? window.top1.innerHeight : de.clientHeight;
let t = window.top1;
let de = t.document.documentElement;
z.x1 = t.pageXOffset ? t.pageXOffset : de.scrollLeft;
z.y1 = t.pageYOffset ? t.pageYOffset : de.scrollTop;
let w1 = t.innerWidth ? t.innerWidth : de.clientWidth;
let h1 = t.innerHeight ? t.innerHeight : de.clientHeight;
z.x2 = z.x1 + w1;
z.y2 = z.y1 + h1;
},
Expand Down Expand Up @@ -152,7 +152,7 @@ export let lib = {
let bk = z.beacons.shift();
while (typeof bk != 'undefined') {
bk.s1 = bk.s1.replace(/_sr=0*_/, '_sr=' + z.sr + '_');
z.log(' ' + bk.a.riff + ' ' + bk.a.unit_id + /* " "+pin.mode+ */ ' ' + bk.a.w + 'x' + bk.a.h + '@' + bk.a.x + ',' + bk.a.y +
z.log(' ' + bk.a.riff + ' ' + bk.a.unit_id + /* ' '+pin.mode+ */ ' ' + bk.a.w + 'x' + bk.a.h + '@' + bk.a.x + ',' + bk.a.y +
' <a href=\'' + bk.s1 + '\'>' + bk.f + '</a>', bk.a.num);
if (bk.a.rnd < Math.pow(10, 1 - (z.sr.charCodeAt(0) & 7))) {
z.scr(bk.s1, bk.a);
Expand Down Expand Up @@ -181,8 +181,8 @@ export let lib = {
'_f=' + f + '_r=' + a.riff +
'_s=' + a.w + 'x' + a.h;
if (a.p) s2 += '_p=' + a.p;
s2 += '_ps=' + this.enc(a.unit_id) + // 08-Jun-15 - _p= is replaced with _ps= - p-number, ps-string
'_dv=' + this.device +
if (f != 'conf') s2 += '_ps=' + this.enc(a.unit_id);
s2 += '_dv=' + this.device +
// + '_a=' + this.enc(a.a)
'_d=' + pin.mode +
'_sr=' + this.sr +
Expand All @@ -191,7 +191,7 @@ export let lib = {
},

enc: function (s1) {
// return escape(s1).replace(/[0-9a-f]{5,}/gi,'RANDOM').replace(/\*/g, "%2A").replace(/_/g, "%5F").replace(/\+/g,
// return escape(s1).replace(/[0-9a-f]{5,}/gi,'RANDOM').replace(/\*/g, '%2A').replace(/_/g, '%5F').replace(/\+/g,
return escape(s1).replace(/\*/g, '%2A').replace(/_/g, '%5F').replace(/\+/g,
'%2B').replace(/\./g, '%2E').replace(/\x2F/g, '%2F');
},
Expand Down Expand Up @@ -467,7 +467,7 @@ export let lib = {
return null;
},

doc: function(f) { // return document of f-iframe, keep here "n" as a parameter because of call from setTimeout()
doc: function(f) { // return document of f-iframe
let d = null;
try {
if (f.contentDocument) d = f.contentDocument; // DOM
Expand Down
23 changes: 23 additions & 0 deletions test/spec/modules/realvuAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,28 @@ describe('RealVu', function() {
let r = boost.readPos(a);
expect(r).to.equal(true);
});

it('send_track', function () {
const a = boost.ads[boost.len - 1];
boost.track(a, 'show', '');
boost.sr = 'a';
boost.send_track();
expect(boost.beacons.length).to.equal(0);
});

it('questA text', function () {
let p = document.createElement('p');
p.innerHTML = 'ABC';
document.body.appendChild(p);
let r = boost.questA(p.firstChild);
document.body.removeChild(p);
expect(r).to.not.equal(null);
});

it('_f=conf', function () {
const a = boost.ads[boost.len - 1];
let r = boost.tru(a, 'conf');
expect(r).to.not.include('_ps=');
});
});
});

0 comments on commit 59fdf0d

Please sign in to comment.