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

Aniview Update CCPA 2.44Legacy #4677

Merged
merged 1 commit into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 28 additions & 17 deletions modules/aniviewBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { VIDEO } from '../src/mediaTypes';
import * as utils from '../src/utils';
import { registerBidder } from '../src/adapters/bidderFactory';
import { Renderer } from '../src/Renderer';

Expand Down Expand Up @@ -50,19 +49,21 @@ function buildRequests(validBidRequests, bidderRequest) {

for (let i = 0; i < validBidRequests.length; i++) {
let bidRequest = validBidRequests[i];
var sizes = [[640, 480]];

if (!bidRequest.sizes || !bidRequest.sizes.length) {
bidRequest.sizes = [[640, 480]];
if (bidRequest.mediaTypes && bidRequest.mediaTypes.video && bidRequest.mediaTypes.video.playerSize) {
sizes = bidRequest.mediaTypes.video.playerSize;
} else {
if (bidRequest.sizes) {
sizes = bidRequest.sizes;
}
}

if (bidRequest.sizes.length === 2 && typeof bidRequest.sizes[0] === 'number' && typeof bidRequest.sizes[1] === 'number') {
let adWidth = bidRequest.sizes[0];
let adHeight = bidRequest.sizes[1];
bidRequest.sizes = [[adWidth, adHeight]];
if (sizes.length === 2 && typeof sizes[0] === 'number') {
sizes = [[sizes[0], sizes[1]]];
}

for (let j = 0; j < bidRequest.sizes.length; j++) {
let size = bidRequest.sizes[j];
for (let j = 0; j < sizes.length; j++) {
let size = sizes[j];
let playerWidth;
let playerHeight;
if (size && size.length == 2) {
Expand All @@ -82,32 +83,42 @@ function buildRequests(validBidRequests, bidderRequest) {
};

if (s2sParams.AV_APPPKGNAME && !s2sParams.AV_URL) { s2sParams.AV_URL = s2sParams.AV_APPPKGNAME; }
if (!s2sParams.AV_IDFA && !s2sParams.AV_URL) { s2sParams.AV_URL = utils.getTopWindowUrl(); }
if (!s2sParams.AV_IDFA && !s2sParams.AV_URL) {
if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
s2sParams.AV_URL = bidderRequest.refererInfo.referer;
} else {
s2sParams.AV_URL = window.location.href;
}
}
if (s2sParams.AV_IDFA && !s2sParams.AV_AID) { s2sParams.AV_AID = s2sParams.AV_IDFA; }
if (s2sParams.AV_AID && !s2sParams.AV_IDFA) { s2sParams.AV_IDFA = s2sParams.AV_AID; }

s2sParams.pbjs = 1;
s2sParams.cb = Math.floor(Math.random() * 999999999);
s2sParams.AV_WIDTH = playerWidth;
s2sParams.AV_HEIGHT = playerHeight;
s2sParams.s2s = '1';
s2sParams.bidId = bidRequest.bidId;
s2sParams.bidWidth = playerWidth;
s2sParams.bidHeight = playerHeight;
s2sParams.bidId = bidRequest.bidId;
s2sParams.pbjs = 1;
s2sParams.tgt = 10;
s2sParams.s2s = '1';

if (bidderRequest && bidderRequest.gdprConsent) {
if (bidderRequest.gdprConsent.gdprApplies) {
s2sParams.AV_GDPR = 1;
s2sParams.AV_CONSENT = bidderRequest.gdprConsent.consentString
s2sParams.AV_CONSENT = bidderRequest.gdprConsent.consentString;
}
}
if (bidderRequest && bidderRequest.uspConsent) {
s2sParams.AV_CCPA = bidderRequest.uspConsent;
}

let serverDomain = bidRequest.params && bidRequest.params.serverDomain ? bidRequest.params.serverDomain : 'gov.aniview.com';
let serverUrl = 'https://' + serverDomain + '/api/adserver/vast3/';
let servingUrl = 'https://' + serverDomain + '/api/adserver/vast3/';

bidRequests.push({
method: 'GET',
url: serverUrl,
url: servingUrl,
data: s2sParams,
bidRequest
});
Expand Down
26 changes: 14 additions & 12 deletions modules/aniviewBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ For more information about [Aniview](http://www.aniview.com), please contact [su
```javascript
var videoAdUnit = [
{
code: 'video1',
sizes: [
[300, 250],
[640, 480]
],
bids: [{
bidder: 'aniview',
params: {
AV_PUBLISHERID: '55b78633181f4603178b4568',
AV_CHANNELID: '55b7904d181f46410f8b4568'
}
}]
code: 'video1',
mediaTypes: {
video: {
playerSize: [[640, 480]],
context: 'instream'
},
},
bids: [{
bidder: 'aniview',
params: {
AV_PUBLISHERID: '55b78633181f4603178b4568',
AV_CHANNELID: '5d19dfca4b6236688c0a2fc4'
}
}]
}];
```

Expand Down