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

parrableIdSystem: Add an optional timezone and timezone offset allow/block filter #5569

Merged
merged 49 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0540240
Add unit coverage for parrableIdSystem getId callback
icflournoy Apr 28, 2020
4af9a6f
PBID-14: Pass uspString to Parrable as us_privacy query parameter
icflournoy Apr 29, 2020
8c84fa3
Merge pull request #6 from Parrable/parrableIdSystem/better-unit-tests
icflournoy Apr 29, 2020
11b457b
PBID-14: Simplify parrableIdSystem us_privacy test
icflournoy Apr 30, 2020
914503e
PBID-14: Only send us_privacy to Parrable when a value exists
icflournoy Apr 30, 2020
82dba43
Merge pull request #7 from Parrable/parrableIdSystem/us-privacy
icflournoy May 1, 2020
1e2ee99
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy May 5, 2020
98835fa
PBID-11: Read new Parrable compound cookie _parrable_id
icflournoy May 5, 2020
43724a3
Remove path check from parrableIdSystem url test
icflournoy May 5, 2020
e88c929
PBID-11: Integrate Parrable compound cookie, consolidating old cookies
icflournoy May 7, 2020
1286adc
PBID-11: Update parrableIdSystem requestBids hook test to support com…
icflournoy May 7, 2020
2be1fb3
PBID-11: Small refactor to parrableIdSystem spec to support compound …
icflournoy May 7, 2020
a9d67ee
PBID-11: Handle legacy ibaOptout as truthy value when migrating to co…
icflournoy May 7, 2020
b71f7fd
PBID-11: Add parrableIdSystem spec tests covering migration of legacy…
icflournoy May 7, 2020
742e3d9
PBID-11: Remove storage documentation from test pages and userId modu…
icflournoy May 7, 2020
16dd083
PBID-11: Remove SUBMODULES_THAT_ALWAYS_REFRESH_ID feature from userId…
icflournoy May 7, 2020
2f80f58
Merge branch 'parrableIdSystem/base' into parrableIdSystem/PBID-11
icflournoy May 7, 2020
7bf438b
PBID-11: Use better serialize implementation for Parrable compound co…
icflournoy May 8, 2020
527303e
PBID-11: Update parrableIdSystem interface documentation
icflournoy May 8, 2020
8f717da
Add missing extension to mock xhr import
icflournoy May 11, 2020
af77318
Merge remote-tracking branch 'origin/parrableIdSystem/base' into parr…
icflournoy May 11, 2020
5d972c0
Merge pull request #9 from Parrable/parrableIdSystem/PBID-11
icflournoy May 12, 2020
39a7ad4
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy May 12, 2020
6ba511b
PBID-11: Try to access eid property only when parrableId object exists
icflournoy May 13, 2020
8e084ab
PBID-11: Construct parrableId from legacy cookies in same manner as c…
icflournoy May 13, 2020
e34e55f
Use hardcoded expiration date for legacy cookies
icflournoy May 13, 2020
253a8ec
Merge remote-tracking branch 'origin/master' into parrableIdSystem/base
icflournoy May 15, 2020
f8650b9
PBID-39: Return full parrableId object in decode method
icflournoy May 15, 2020
ea3862f
PBID-39: Update all adapters to use parrableId.eid for userId value
icflournoy May 15, 2020
37f7da4
PBID-39: Update config for ORTB EIDs to extract parrableId.eid as Use…
icflournoy May 15, 2020
be2c51d
PBID-39: Pass Parrable IBA and CCPA optout status into ORTB EIDs list…
icflournoy May 15, 2020
754bc7f
PBID-39: Pass a true CCPA optout status to adapters when the EID has …
icflournoy May 15, 2020
2486d2d
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy May 18, 2020
373075f
parrableIdSystem: Relocate new unit test from upstream
icflournoy May 18, 2020
350c091
Merge remote-tracking branch 'origin/parrableIdSystem/base' into parr…
icflournoy May 18, 2020
df73ab9
PBID-39: Fallback to cookie values when backend response is missing c…
icflournoy May 19, 2020
50dc9ef
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy May 26, 2020
fa9c9e3
PBID-39: Avoid breaking openx bid adapter when renaming our id system
icflournoy May 27, 2020
034c5ef
PBID-39: Use array find
icflournoy May 27, 2020
3b8842b
Merge pull request #10 from Parrable/parrableIdSystem/PBID-39
icflournoy Jun 9, 2020
9bf7846
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy Jun 9, 2020
d0d3b91
Use supported array find method in parrableIdSystem_spec
icflournoy Jun 9, 2020
353ec8e
Restore backwards-compatible parrableId passing to OpenxBidAdapter
icflournoy Jun 19, 2020
a92d499
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy Jun 19, 2020
d82afbc
PBID-25: Add time zone and offset filtering of impressions to parrabl…
icflournoy May 19, 2020
adaf596
PBID-25: Better group existing getId tests
icflournoy May 19, 2020
46f535c
PBID-25: Add unit tests covering time zone and offset filtering funct…
icflournoy May 19, 2020
4a60387
PBID-25: Remove parrable .only test scope
icflournoy Jun 23, 2020
47234f4
Merge remote-tracking branch 'upstream/master' into parrableIdSystem/…
icflournoy Aug 4, 2020
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
49 changes: 49 additions & 0 deletions modules/parrableIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,51 @@ function migrateLegacyCookies(parrableId) {
}
}

function shouldFilterImpression(configParams, parrableId) {
const config = configParams.timezoneFilter;

if (!config) {
return false;
}

if (parrableId) {
return false;
}

const offset = (new Date()).getTimezoneOffset() / 60;
const zone = Intl.DateTimeFormat().resolvedOptions().timeZone;

function isAllowed() {
if (utils.isEmpty(config.allowedZones) &&
utils.isEmpty(config.allowedOffsets)) {
return true;
}
if (utils.contains(config.allowedZones, zone)) {
return true;
}
if (utils.contains(config.allowedOffsets, offset)) {
return true;
}
return false;
}

function isBlocked() {
if (utils.isEmpty(config.blockedZones) &&
utils.isEmpty(config.blockedOffsets)) {
return false;
}
if (utils.contains(config.blockedZones, zone)) {
return true;
}
if (utils.contains(config.blockedOffsets, offset)) {
return true;
}
return false;
}

return !isAllowed() || isBlocked();
}

function fetchId(configParams) {
if (!isValidConfig(configParams)) return;

Expand All @@ -122,6 +167,10 @@ function fetchId(configParams) {
migrateLegacyCookies(parrableId);
}

if (shouldFilterImpression(configParams, parrableId)) {
return null;
}

const eid = (parrableId) ? parrableId.eid : null;
const refererInfo = getRefererInfo();
const uspString = uspDataHandler.getConsentData();
Expand Down
Loading