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

update to add coop sync param to cookie sync scripts #223

Merged
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
3 changes: 3 additions & 0 deletions src/cookieSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const BIDDER_ARGS = sanitizeBidders(parseQueryParam('bidders', window.location.s
const IS_AMP = sanitizeSource(parseQueryParam('source', window.location.search));
const maxSyncCountParam = parseQueryParam('max_sync_count', window.location.search);
const MAX_SYNC_COUNT = sanitizeSyncCount(parseInt((maxSyncCountParam) ? maxSyncCountParam : 10, 10));
const coopSyncParam = parseQueryParam('coop_sync', window.location.search);
const COOP_SYNC = !coopSyncParam || coopSyncParam === 'true' || !!parseInt(coopSyncParam);
const GDPR = sanitizeGdpr(parseInt(parseQueryParam('gdpr', window.location.search), 10));
const GDPR_CONSENT = sanitizeGdprConsent(parseQueryParam('gdpr_consent', window.location.search));

Expand Down Expand Up @@ -254,6 +256,7 @@ function sanitizeBidders(value) {
function getStringifiedData(endPointArgs) {
var data = (endPointArgs && typeof endPointArgs === 'object') ? endPointArgs : {}
data['limit'] = MAX_SYNC_COUNT;
data['coopSync'] = COOP_SYNC;

if(GDPR) data.gdpr = GDPR;
if(GDPR_CONSENT) data.gdpr_consent = GDPR_CONSENT;
Expand Down
3 changes: 3 additions & 0 deletions src/cookieSyncWithConsent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const IS_AMP = sanitizeSource(parseQueryParam('source', window.location.search))
const BIDDER_ARGS = sanitizeBidders(parseQueryParam('bidders', window.location.search));
const maxSyncCountParam = parseQueryParam('max_sync_count', window.location.search);
const MAX_SYNC_COUNT = sanitizeSyncCount(parseInt((maxSyncCountParam) ? maxSyncCountParam : 10, 10));
const coopSyncParam = parseQueryParam('coop_sync', window.location.search);
const COOP_SYNC = !coopSyncParam || coopSyncParam === 'true' || !!parseInt(coopSyncParam);
const TIMEOUT = sanitizeTimeout(parseInt(parseQueryParam('timeout', window.location.search), 10));
const DEFAULT_GDPR_SCOPE = sanitizeScope(parseInt(parseQueryParam('defaultGdprScope', window.location.search), 10));

Expand Down Expand Up @@ -273,6 +275,7 @@ function attachConsent(data) {
function getStringifiedData(endPointArgs) {
var data = (endPointArgs && typeof endPointArgs === 'object') ? endPointArgs : {}
data['limit'] = MAX_SYNC_COUNT;
data['coopSync'] = COOP_SYNC;

if(IS_AMP) data.filterSettings = {
iframe: {
Expand Down