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

Ras Bid Adapter: support for SlotSequence parameter #8792

Merged
merged 3 commits into from
Aug 18, 2022
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
8 changes: 8 additions & 0 deletions modules/rasBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js';
import { isEmpty, getAdUnitSizes, parseSizesInput, deepAccess } from '../src/utils.js';
Expand Down Expand Up @@ -90,11 +91,18 @@ const getSlots = (bidRequests) => {
const batchSize = bidRequests.length;
for (let i = 0; i < batchSize; i++) {
const adunit = bidRequests[i];
const slotSequence = utils.deepAccess(adunit, 'params.slotSequence');

const sizes = parseSizesInput(getAdUnitSizes(adunit)).join(',');

queryString += `&slot${i}=${encodeURIComponent(adunit.params.slot)}&id${i}=${encodeURIComponent(adunit.bidId)}&composition${i}=CHILD`;

if (sizes.length) {
queryString += `&iusizes${i}=${encodeURIComponent(sizes)}`;
}
if (slotSequence !== undefined) {
queryString += `&pos${i}=${encodeURIComponent(slotSequence)}`;
}
}
return queryString;
};
Expand Down
27 changes: 14 additions & 13 deletions modules/rasBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@ var adUnits = [{

# Parameters

| Name | Scope | Type | Description | Example
| --- | --- | --- | --- | ---
| network | required | String | Specific identifier provided by RAS | `"4178463"`
| site | required | String | Specific identifier name (case-insensitive) that is associated with this ad unit and provided by RAS | `"example_com"`
| area | required | String | Ad unit category name; only case-insensitive alphanumeric with underscores and hyphens are allowed | `"sport"`
| slot | required | String | Ad unit placement name (case-insensitive) provided by RAS | `"slot"`
| pageContext | optional | Object | Web page context data | `{}`
| pageContext.dr | optional | String | Document referrer URL address | `"https://example.com/"`
| pageContext.du | optional | String | Document URL address | `"https://example.com/sport/football/article.html?id=932016a5-02fc-4d5c-b643-fafc2f270f06"`
| Name | Scope | Type | Description | Example
| --- | --- | --- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---
| network | required | String | Specific identifier provided by RAS | `"4178463"`
| site | required | String | Specific identifier name (case-insensitive) that is associated with this ad unit and provided by RAS | `"example_com"`
| area | required | String | Ad unit category name; only case-insensitive alphanumeric with underscores and hyphens are allowed | `"sport"`
| slot | required | String | Ad unit placement name (case-insensitive) provided by RAS | `"slot"`
| slotSequence | optional | Number | Ad unit sequence position provided by RAS | `1`
| pageContext | optional | Object | Web page context data | `{}`
| pageContext.dr | optional | String | Document referrer URL address | `"https://example.com/"`
| pageContext.du | optional | String | Document URL address | `"https://example.com/sport/football/article.html?id=932016a5-02fc-4d5c-b643-fafc2f270f06"`
| pageContext.dv | optional | String | Document virtual address as slash-separated path that may consist of any number of parts (case-insensitive alphanumeric with underscores and hyphens); first part should be the same as `site` value and second as `area` value; next parts may reflect website navigation | `"example_com/sport/football"`
| pageContext.keyWords | optional | String[] | List of keywords associated with this ad unit; only case-insensitive alphanumeric with underscores and hyphens are allowed | `["euro", "lewandowski"]`
| pageContext.keyValues | optional | Object | Key-values associated with this ad unit (case-insensitive); following characters are not allowed in the values: `" ' = ! + # * ~ ; ^ ( ) < > [ ] & @` | `{}`
| pageContext.keyValues.ci | optional | String | Content unique identifier | `"932016a5-02fc-4d5c-b643-fafc2f270f06"`
| pageContext.keyValues.adunit | optional | String | Ad unit name | `"example_com/sport"`
| pageContext.keyWords | optional | String[] | List of keywords associated with this ad unit; only case-insensitive alphanumeric with underscores and hyphens are allowed | `["euro", "lewandowski"]`
| pageContext.keyValues | optional | Object | Key-values associated with this ad unit (case-insensitive); following characters are not allowed in the values: `" ' = ! + # * ~ ; ^ ( ) < > [ ] & @` | `{}`
| pageContext.keyValues.ci | optional | String | Content unique identifier | `"932016a5-02fc-4d5c-b643-fafc2f270f06"`
| pageContext.keyValues.adunit | optional | String | Ad unit name | `"example_com/sport"`
2 changes: 2 additions & 0 deletions test/spec/modules/rasBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('rasBidAdapter', function () {
slot: 'test',
area: 'areatest',
site: 'test',
slotSequence: '0',
network: '4178463'
}
};
Expand Down Expand Up @@ -140,6 +141,7 @@ describe('rasBidAdapter', function () {
expect(requests[0].url).to.have.string('DV=test%2Fareatest');
expect(requests[0].url).to.have.string('kwrd=val1%2Bval2');
expect(requests[0].url).to.have.string('kvadunit=test%2Fareatest');
expect(requests[0].url).to.have.string('pos0=0');
});
});

Expand Down