Skip to content

Commit

Permalink
Merge branch 'master' into RPRD-1638-native-and-multi-support
Browse files Browse the repository at this point in the history
  • Loading branch information
michachen committed Jan 14, 2025
2 parents ffc8b36 + ea87c0e commit 2beca8b
Show file tree
Hide file tree
Showing 92 changed files with 6,753 additions and 3,664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
advertising: { client: 'vast' }
advertising: { client: 'vast' },
width: 640,
height: 480
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: {
client: "googima",
schedule: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
2 changes: 2 additions & 0 deletions integrationExamples/videoModule/jwplayer/eventListeners.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
mediaid: 'd9J2zcaA',
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
2 changes: 2 additions & 0 deletions integrationExamples/videoModule/jwplayer/eventsUI.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: "Subaru Outback on Street and Dirt",
}],
width: 640,
height: 480,
advertising: { client: 'vast' }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
params: {
vendorConfig: {
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
width: 640,
height: 480,
advertising: { client: 'googima' }
}
}
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/mediaMetadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
file: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4',
title: 'Subaru Outback On Street And Dirt',
description: 'Smoking Tire takes the all-new Subaru Outback to the highest point we can find in hopes our customer-appreciation Balloon Launch will get some free T-shirts into the hands of our viewers.',
advertising: { client: 'googima' }
advertising: { client: 'googima' },
width: 640,
height: 480
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion integrationExamples/videoModule/jwplayer/playlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
title : "Sintel",
description: "Sintel is an independently produced short film, initiated by the Blender Foundation as a means to further improve and validate the free/open source 3D creation suite Blender. With initial funding provided by 1000s of donations via the internet community, it has again proven to be a viable development model for both open 3D technology as for independent animation film.\nThis 15 minute film has been realized in the studio of the Amsterdam Blender Institute, by an international team of artists and developers. In addition to that, several crucial technical and creative targets have been realized online, by developers and artists and teams all over the world.\nwww.sintel.org",
}],
advertising: { client: 'vast' }
advertising: { client: 'vast' },
width: 640,
height: 480
}
}
}
Expand Down
18 changes: 16 additions & 2 deletions libraries/analyticsAdapter/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ import { EVENTS } from '../../src/constants.js';
import {ajax} from '../../src/ajax.js';
import {logError, logMessage} from '../../src/utils.js';
import * as events from '../../src/events.js';
import {config} from '../../src/config.js';

export const _internal = {
ajax
};
const ENDPOINT = 'endpoint';
const BUNDLE = 'bundle';
const LABELS_KEY = 'analyticsLabels';

let labels = {};

config.getConfig(LABELS_KEY, (cfg) => {
labels = cfg[LABELS_KEY]
});

export const DEFAULT_INCLUDE_EVENTS = Object.values(EVENTS)
.filter(ev => ev !== EVENTS.AUCTION_DEBUG);
Expand Down Expand Up @@ -90,12 +98,18 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler }
}

function _callEndpoint({ eventType, args, callback }) {
_internal.ajax(url, callback, JSON.stringify({ eventType, args }));
_internal.ajax(url, callback, JSON.stringify({ eventType, args, labels }));
}

function _enqueue({eventType, args}) {
queue.push(() => {
this.track({eventType, args});
if (Object.keys(labels || []).length > 0) {
args = {
[LABELS_KEY]: labels,
...args,
}
}
this.track({eventType, labels, args});
});
emptyQueue();
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);
const contentLang = deepAccess(bidderRequest, 'ortb2.site.content.language') || document.documentElement.lang;
const coppa = deepAccess(bidderRequest, 'ortb2.regs.coppa', 0);
const device = deepAccess(bidderRequest, 'ortb2.device', {});

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
Expand Down Expand Up @@ -290,6 +291,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
bidderRequestsCount: bidderRequestsCount,
bidderWinsCount: bidderWinsCount,
bidderTimeout: bidderTimeout,
device,
...uniqueRequestData
};

Expand Down
87 changes: 64 additions & 23 deletions modules/33acrossIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function calculateResponseObj(response) {
};
}

function calculateQueryStringParams({ pid, hem }, gdprConsentData, enabledStorageTypes) {
function calculateQueryStringParams({ pid, pubProvidedHem }, gdprConsentData, enabledStorageTypes) {
const uspString = uspDataHandler.getConsentData();
const coppaValue = coppaDataHandler.getCoppa();
const gppConsent = gppDataHandler.getConsentData();
Expand Down Expand Up @@ -98,9 +98,9 @@ function calculateQueryStringParams({ pid, hem }, gdprConsentData, enabledStorag
params.tp = encodeURIComponent(tp);
}

const hemParam = hem || getStoredValue(STORAGE_HEM_KEY, enabledStorageTypes);
if (hemParam) {
params.sha256 = encodeURIComponent(hemParam);
const hem = pubProvidedHem || getStoredValue(STORAGE_HEM_KEY, enabledStorageTypes);
if (hem) {
params.sha256 = encodeURIComponent(hem);
}

return params;
Expand Down Expand Up @@ -145,10 +145,51 @@ function getStoredValue(key, enabledStorageTypes) {
return storedValue;
}

function handleSupplementalId(key, id, storageConfig) {
id
? storeValue(key, id, storageConfig)
: deleteFromStorage(key);
function filterEnabledSupplementalIds({ tp, fp, hem }, { storeFpid, storeTpid, envelopeAvailable }) {
const ids = [];

if (storeFpid) {
ids.push(
/**
* [
* <storage key>,
* < ID value to store or remove >,
* < clear flag: indicates if existing storage item should be removed or not based on certain condition>
* ]
*/
[STORAGE_FPID_KEY, fp, !fp],
[STORAGE_HEM_KEY, hem, !envelopeAvailable] // Clear hashed email if envelope is not available
);
}

if (storeTpid) {
ids.push([STORAGE_TPID_KEY, tp, !tp]);
}

return ids;
}

function updateSupplementalIdStorage(supplementalId, storageConfig) {
const [ key, id, clear ] = supplementalId;

if (clear) {
deleteFromStorage(key);

return;
}

if (id) {
storeValue(key, id, storageConfig);
}
}

function handleSupplementalIds(ids, { enabledStorageTypes, expires, ...options }) {
filterEnabledSupplementalIds(ids, options).forEach((supplementalId) => {
updateSupplementalIdStorage(supplementalId, {
enabledStorageTypes,
expires
})
});
}

/** @type {Submodule} */
Expand Down Expand Up @@ -197,8 +238,10 @@ export const thirtyThreeAcrossIdSubmodule = {
const {
storeFpid = DEFAULT_1PID_SUPPORT,
storeTpid = DEFAULT_TPID_SUPPORT, apiUrl = API_URL,
...options
pid,
hem
} = params;
const pubProvidedHem = hem || window._33across?.hem?.sha256;

return {
callback(cb) {
Expand All @@ -218,19 +261,17 @@ export const thirtyThreeAcrossIdSubmodule = {
});
}

if (storeFpid) {
handleSupplementalId(STORAGE_FPID_KEY, responseObj.fp, {
enabledStorageTypes,
expires: storageConfig.expires
});
}

if (storeTpid) {
handleSupplementalId(STORAGE_TPID_KEY, responseObj.tp, {
enabledStorageTypes,
expires: storageConfig.expires
});
}
handleSupplementalIds({
fp: responseObj.fp,
tp: responseObj.tp,
hem: pubProvidedHem
}, {
storeFpid,
storeTpid,
envelopeAvailable: !!responseObj.envelope,
enabledStorageTypes,
expires: storageConfig.expires
});

cb(responseObj.envelope);
},
Expand All @@ -239,7 +280,7 @@ export const thirtyThreeAcrossIdSubmodule = {

cb();
}
}, calculateQueryStringParams(options, gdprConsentData, enabledStorageTypes), {
}, calculateQueryStringParams({ pid, pubProvidedHem }, gdprConsentData, enabledStorageTypes), {
method: 'GET',
withCredentials: true
});
Expand Down
3 changes: 2 additions & 1 deletion modules/33acrossIdSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ The following settings are available in the `params` property in `userSync.userI

### HEM Collection

33Across ID System supports user's hashed email, if available in storage.
33Across ID System supports user's hashed emails (HEMs). HEMs could be collected from 3 different sources in following
priority order: `hem` configuration parameter, global `_33across.hem.sha256` field or from storage (cookie or local storage).
34 changes: 24 additions & 10 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
deepAccess,
deepClone,
generateUUID,
getDNT,
getWindowSelf,
isArray,
isFn,
Expand All @@ -14,6 +13,7 @@ import {
logError,
logInfo,
logWarn,
mergeDeep,
} from '../src/utils.js';
import { getRefererInfo, parseDomain } from '../src/refererDetection.js';
import { OUTSTREAM, validateOrtbVideoFields } from '../src/video.js';
Expand All @@ -39,19 +39,33 @@ export const BB_RENDERER_URL = `https://${BB_PUBLICATION}.bbvms.com/r/$RENDERER.
const CURRENCY = 'USD';

/**
* Returns the window.ADAGIO global object used to store Adagio data.
* This object is created in window.top if possible, otherwise in window.self.
* Get device data object, with some properties
* deviated from the OpenRTB spec.
* @param {Object} ortb2Data
* @returns {Object} Device data object
*/
function getDevice() {
function getDevice(ortb2Data) {
const _device = {};

// Merge the device object from ORTB2 data.
if (ortb2Data?.device) {
mergeDeep(_device, ortb2Data.device);
}

// If the geo object is not defined, create it.
if (!_device.geo) {
_device.geo = {};
}

const language = navigator.language ? 'language' : 'userLanguage';
return {
mergeDeep(_device, {
userAgent: navigator.userAgent,
language: navigator[language],
dnt: getDNT() ? 1 : 0,
geo: {},
js: 1
};
};
});

return _device;
}

function getSite(bidderRequest) {
const { refererInfo } = bidderRequest;
Expand Down Expand Up @@ -502,7 +516,7 @@ export const spec = {
validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);

const secure = (location.protocol === 'https:') ? 1 : 0;
const device = _internal.getDevice();
const device = _internal.getDevice(bidderRequest?.ortb2);
const site = _internal.getSite(bidderRequest);
const pageviewId = _internal.getAdagioNs().pageviewId;
const gdprConsent = _getGdprConsent(bidderRequest) || {};
Expand Down
24 changes: 15 additions & 9 deletions modules/adagioRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ const _SESSION = (function() {

const isNewSess = isNewSession(expiry);

// if lastActivityTime is defined it means that the website is using the original version of the snippet
const v = !lastActivityTime ? LATEST_ABTEST_VERSION : undefined;
const abTest = _internal.getAbTestFromLocalStorage(storageValue);

// if abTest is defined it means that the website is using the new version of the snippet
const v = abTest ? LATEST_ABTEST_VERSION : undefined;

data.session = {
v,
rnd,
pages: pages || 1,
new: isNewSess, // legacy: `new` was used but the choosen name is not good.
// Don't use values if they are not defined.
...(v !== undefined && { v }),
...(vwSmplg !== undefined && { vwSmplg }),
...(vwSmplgNxt !== undefined && { vwSmplgNxt }),
...(expiry !== undefined && { expiry }),
Expand All @@ -98,15 +100,19 @@ const _SESSION = (function() {
data.session.rnd = Math.random();
}

const { testName, testVersion, expiry: abTestExpiry, sessionId } = _internal.getAbTestFromLocalStorage(storageValue);
if (v === LATEST_ABTEST_VERSION) {
const { testName, testVersion, expiry: abTestExpiry, sessionId } = abTest;
if (abTestExpiry && abTestExpiry > Date.now() && (!sessionId || sessionId === data.session.id)) { // if AbTest didn't set a session id, it's probably because it's a new one and it didn't retrieve it yet, assume it's okay to get test Name and Version.
data.session.testName = testName;
data.session.testVersion = testVersion;
if (testName && testVersion) {
data.session.testName = testName;
data.session.testVersion = testVersion;
}
}
} else {
data.session.testName = legacyTestName;
data.session.testVersion = legacyTestVersion;
if (legacyTestName && legacyTestVersion) {
data.session.testName = legacyTestName;
data.session.testVersion = legacyTestVersion;
}
}

_internal.getAdagioNs().queue.push({
Expand Down Expand Up @@ -215,7 +221,7 @@ export const _internal = {
getAbTestFromLocalStorage: function(storageValue) {
const obj = this.getObjFromStorageValue(storageValue);

return (!obj || !obj.abTest) ? {} : obj.abTest;
return (!obj || !obj.abTest) ? null : obj.abTest;
},

/**
Expand Down
Loading

0 comments on commit 2beca8b

Please sign in to comment.