Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Release/1.26.0 #9

Merged
merged 6 commits into from
Sep 12, 2017
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
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
AOL Prebid 1.26.0
----------------
Added restrictions for adIdExtension field.
Added partners ids for s2s support.


AOL Prebid 1.25.0
----------------
Updated to Prebid 0.26.1
Expand Down
8 changes: 7 additions & 1 deletion modules/aolAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,18 @@ let aolAnalyticsAdapter = Object.assign(adapter({
let adId;

if (adUnit.adIdExtension) {
adId = adUnit.code + '-' + adUnit.adIdExtension;
adId = this.formatAdIdWithExtension(adUnit);
} else {
adId = adUnit.code;
}

return encodeURIComponent(adId);
},

formatAdIdWithExtension(adUnit) {
let adId = `${adUnit.code}-${adUnit.adIdExtension}`;

return adId.replace(/[^\da-z|%:\.\-_&\$]/gi, '');
}
});

Expand Down
8 changes: 7 additions & 1 deletion modules/aolPartnersIds.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
"eplanning": 80,
"spotx": 81,
"ucfunnel": 82,
"kargo": 83
"kargo": 83,
"appnexusS2S": 84,
"indexExchangeS2S": 85,
"onedisplayS2S": 86,
"pubmaticS2S": 87,
"medianetS2S": 88,
"geminiS2S": 89
}
40 changes: 35 additions & 5 deletions test/spec/modules/aolAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1356,10 +1356,18 @@ describe('AOL analytics adapter', () => {

describe('generateAdId()', () => {
let adUnit;
let formatAdIdWithExtensionStub;

beforeEach(() => {
adUnit = {
code: 'ad-unit-code'
};

formatAdIdWithExtensionStub = sinon.stub(aolAnalytics, 'formatAdIdWithExtension');
});

afterEach(() => {
formatAdIdWithExtensionStub.restore();
});

it('should return adunit code when aolParams field is undefined', () => {
Expand Down Expand Up @@ -1388,15 +1396,37 @@ describe('AOL analytics adapter', () => {

it('should return adId with extension when adIdExtension is present', () => {
adUnit.adIdExtension = 'test-adId-postfix';
formatAdIdWithExtensionStub.returns('formatted-ad-id');

expect(aolAnalytics.generateAdId(adUnit)).to.equal('formatted-ad-id');
expect(formatAdIdWithExtensionStub.withArgs(adUnit).calledOnce).to.be.true;
});

it('should always return encoded adId value', () => {
adUnit.code = 'ad@code+$test&@adI#d/=value+encoding';

expect(aolAnalytics.generateAdId(adUnit)).to.equal(encodeURIComponent(adUnit.code));
});
});

describe('formatAdIdWithExtension()', () => {
let adUnit;

beforeEach(() => {
adUnit = {
code: 'ad-unit-code',
adIdExtension: 'test-adId-postfix'
};
});

expect(aolAnalytics.generateAdId(adUnit)).to.equal(adUnit.code + '-test-adId-postfix');
it('should return formatted adId', () => {
expect(aolAnalytics.formatAdIdWithExtension(adUnit)).to.equal(`${adUnit.code}-${adUnit.adIdExtension}`);
});

it('should return encoded adId with extension when code or adIdExtension contains special characters', () => {
adUnit.code = 'ad@code+';
adUnit.adIdExtension = '$test&@adI#d/post=fix+encoding';
it('should return formatted adId without illegal symbols', () => {
adUnit.adIdExtension = '!@#\'*()+!!!123legalSYMBOls|%:.-_&$56789EnD!@#\'*()+!!!';

expect(aolAnalytics.generateAdId(adUnit)).to.equal(encodeURIComponent(adUnit.code + '-' + adUnit.adIdExtension));
expect(aolAnalytics.formatAdIdWithExtension(adUnit)).to.equal(`${adUnit.code}-123legalSYMBOls|%:.-_&$56789EnD`);
});
});
});