Skip to content

Commit

Permalink
AdYouLike bidAdapter - Add information in bid request (#5828)
Browse files Browse the repository at this point in the history
* Remove useless bidderCode in bid response

* send all the available sizes in the bid request

* Use the banner sizes if given

* avoid compatibility issue with old bid format

* ad iframe and publisher domain paramters to bid requests

* add publisher domain info in ad request

* add a check in unit tests for publisherDomain

* encode uri components

Co-authored-by: Guillaume <guiandouard@gmail.com>
  • Loading branch information
guiann and guiann authored Oct 7, 2020
1 parent ba1a35c commit e082c83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
26 changes: 14 additions & 12 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import find from 'core-js-pure/features/array/find.js';

const VERSION = '1.0';
Expand Down Expand Up @@ -104,15 +105,6 @@ function getHostname(bidderRequest) {
return '';
}

/* Get current page referrer url */
function getReferrerUrl(bidderRequest) {
let referer = '';
if (bidderRequest && bidderRequest.refererInfo) {
referer = bidderRequest.refererInfo.referer;
}
return referer;
}

/* Get current page canonical url */
function getCanonicalUrl() {
let link;
Expand Down Expand Up @@ -155,16 +147,26 @@ function createEndpoint(bidRequests, bidderRequest) {
function createEndpointQS(bidderRequest) {
const qs = {};

const ref = getReferrerUrl(bidderRequest);
if (ref) {
qs.RefererUrl = encodeURIComponent(ref);
if (bidderRequest) {
const ref = bidderRequest.refererInfo;
if (ref) {
qs.RefererUrl = encodeURIComponent(ref.referer);
if (ref.numIframes > 0) {
qs.SafeFrame = true;
}
}
}

const can = getCanonicalUrl();
if (can) {
qs.CanonicalUrl = encodeURIComponent(can);
}

const domain = config.getConfig('publisherDomain');
if (domain) {
qs.PublisherDomain = encodeURIComponent(domain);
}

return qs;
}

Expand Down
1 change: 1 addition & 0 deletions test/spec/modules/adyoulikeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ describe('Adyoulike Adapter', function () {
expect(request.method).to.equal('POST');
expect(request.url).to.contains('CanonicalUrl=' + encodeURIComponent(canonicalUrl));
expect(request.url).to.contains('RefererUrl=' + encodeURIComponent(referrerUrl));
expect(request.url).to.contains('PublisherDomain=http%3A%2F%2Flocalhost%3A9876');

expect(payload.Version).to.equal('1.0');
expect(payload.Bids['bid_id_0'].PlacementID).to.be.equal('placement_0');
Expand Down

0 comments on commit e082c83

Please sign in to comment.