Skip to content

Commit

Permalink
Vidazoo Bid Adapter: cache optimizations (#9209)
Browse files Browse the repository at this point in the history
* feat(module): multi size request

* fix getUserSyncs
added tests

* update(module): package-lock.json from master

* feat(module): VidazooBidAdapter - send top query params to server

* feat(module): vidazoo bid adapter - added performance optimization

Co-authored-by: roman <shmoop207@gmail.com>
Co-authored-by: Saar Amrani <89377180+saar120@users.noreply.github.com>
Co-authored-by: Saar Amrani <saar120@gmail.com>
  • Loading branch information
4 people committed Nov 10, 2022
1 parent a64c8c0 commit 4082e8a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/vidazooBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TTL_SECONDS = 60 * 5;
const DEAL_ID_EXPIRY = 1000 * 60 * 15;
const UNIQUE_DEAL_ID_EXPIRY = 1000 * 60 * 60;
const SESSION_ID_KEY = 'vidSid';
const OPT_CACHE_KEY = 'vdzwopt';
export const SUPPORTED_ID_SYSTEMS = {
'britepoolid': 1,
'criteoId': 1,
Expand Down Expand Up @@ -66,6 +67,7 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
const cId = extractCID(params);
const pId = extractPID(params);
const subDomain = extractSubDomain(params);
const ptrace = getCacheOpt();

let data = {
url: encodeURIComponent(topWindowUrl),
Expand All @@ -83,7 +85,8 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest) {
bidderVersion: BIDDER_VERSION,
prebidVersion: '$prebid.version$',
res: `${screen.width}x${screen.height}`,
schain: schain
schain: schain,
ptrace: ptrace
};

appendUserIdsToRequestPayload(data, userId);
Expand Down Expand Up @@ -258,6 +261,16 @@ export function getVidazooSessionId() {
return getStorageItem(SESSION_ID_KEY) || '';
}

export function getCacheOpt() {
let data = storage.getDataFromLocalStorage(OPT_CACHE_KEY);
if (!data) {
data = String(Date.now());
storage.setDataInLocalStorage(OPT_CACHE_KEY, data);
}

return data;
}

export function getStorageItem(key) {
try {
return tryParseJSON(storage.getDataFromLocalStorage(key));
Expand Down
1 change: 1 addition & 0 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ describe('VidazooBidAdapter', function () {
bidderVersion: adapter.version,
prebidVersion: version,
schain: BID.schain,
ptrace: '1000',
res: `${window.top.screen.width}x${window.top.screen.height}`,
uqs: getTopWindowQueryParams(),
'ext.param1': 'loremipsum',
Expand Down

0 comments on commit 4082e8a

Please sign in to comment.