Skip to content

Commit

Permalink
Merge pull request #21 from gladly-team/kevin/qc-choice-v22
Browse files Browse the repository at this point in the history
Upgrade to Quantcast Choice v22
  • Loading branch information
kmjennison authored Nov 13, 2020
2 parents 6e9dcf9 + 4e14aed commit 0067bce
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 28 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
env:
LOG_TEST_COVERAGE: true
steps:
- uses: actions/checkout@v2
- name: Run tests and build on Node
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"test:coverage": "yarn run test:run --coverage",
"test:watch": "yarn run test:run --watch",
"quantcast:update": "npm-run-all -s quantcast:update:info quantcast:choice-js:update quantcast:cmp-js:download",
"quantcast:update:info": "echo \"########## Downloading the original source JS for Quantcast Choice version 14. To use a different version, first update change the version number in the QC portal for the tab.gladly.dev domain, then modify the version number in the cmp2.js URL in the package.json script.##########\"",
"quantcast:update:info": "echo \"########## Downloading the original source JS for Quantcast Choice version 22. To use a different version, first update change the version number in the QC portal for the tab.gladly.dev domain, then modify the version number in the cmp2.js URL in the package.json script.##########\"",
"quantcast:choice-js:update": "npm-run-all -s quantcast:choice-js:download quantcast:choice-js:format",
"quantcast:choice-js:download": "curl https://quantcast.mgr.consensu.org/choice/FPBLJYpJgR9Zu/tab.gladly.dev/choice.js > ./quantcast/qcChoiceOriginal.js",
"quantcast:choice-js:format": "eslint ./quantcast/qcChoiceOriginal.js --fix --no-ignore; exit 0",
"quantcast:cmp-js:download": "curl https://quantcast.mgr.consensu.org/tcfv2/14/cmp2.js > ./quantcast/qcCmpOriginal.js",
"quantcast:cmp-js:download": "curl https://quantcast.mgr.consensu.org/tcfv2/22/cmp2.js > ./quantcast/qcCmpOriginal.js",
"quantcast:cmp-js:copy-with-edits": "sed -E 's/SameSite=Lax;secure/SameSite=None;secure/g; s/_isUserInUS=(true|false)/_isUserInUS=window.tabCMP.doesCCPAApply/g; s/_isUserInEU=(true|false)/_isUserInEU=window.tabCMP.doesGDPRApply/g;' ./quantcast/qcCmpOriginal.js > ./src/qcCmpModified.js",
"dev:publish": "npm-run-all -s build dev:yalc-publish-push",
"dev:yalc-publish-push": "yalc publish --push"
Expand Down
25 changes: 15 additions & 10 deletions quantcast/qcChoiceOriginal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const firstScript = document.getElementsByTagName('script')[0]
cmpScriptElement.async = true
cmpScriptElement.type = 'text/javascript'
const cmpVersion = 'https://quantcast.mgr.consensu.org/tcfv2/14/cmp2.js'
const cmpVersion = 'https://quantcast.mgr.consensu.org/tcfv2/22/cmp2.js'
cmpScriptElement.src = cmpVersion
window._qevents = window._qevents || []
;(function () {
Expand Down Expand Up @@ -130,13 +130,22 @@
},
theme: { uxPrimaryButtonColor: '#9d4ba3' },
coreConfig: {
initScreenBodyTextOption: 1,
consentScope: 'service',
thirdPartyStorageType: 'iframe',
consentIdentityEnabled: false,
initScreenBodyTextOption: 1,
consentOnSafari: false,
lang_: 'en',
defaultToggleValue: 'off',
displayUi: 'inEU',
displayPersistentConsentLink: false,
defaultToggleValue: 'off',
initScreenRejectButtonShowing: false,
publisherConsentRestrictionIds: [],
publisherLIRestrictionIds: [],
softOptInEnabled: false,
showSummaryView: true,
persistentConsentLinkLocation: 4,
displayPersistentConsentLink: false,
uiLayout: 'popup',
publisherLogo:
'https://tab.gladly.io/static/logo-with-text-257bbffc6dcac5076e8ac31eed8ff73c.svg',
publisherPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Expand All @@ -145,15 +154,10 @@
publisherFeaturesIds: [],
publisherSpecialFeaturesIds: [],
stacks: [1, 42],
softOptInEnabled: false,
uiLayout: 'popup',
vendorListUpdateFreq: 90,
thirdPartyStorageType: 'iframe',
showSummaryView: true,
persistentConsentLinkLocation: 4,
quantcastAccountId: 'FPBLJYpJgR9Zu',
privacyMode: ['GDPR', 'USP'],
hashCode: 'klt866OJQEpWMQn5tnZBBg',
hashCode: 'viIA/yKcUUmwj5xfSRz5eQ',
publisherCountryCode: 'US',
publisherName: 'LOCAL - Tab for a Cause',
vendorPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Expand All @@ -167,5 +171,6 @@
uspLspact: 'N',
suppressCcpaLinks: true,
},
nonIabVendorsInfo: {},
})
})()
3 changes: 1 addition & 2 deletions quantcast/qcCmpOriginal.js

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions src/initCMP.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,33 @@ const initCMP = (options) => {
},
theme: { uxPrimaryButtonColor: primaryButtonColor },
coreConfig: {
initScreenBodyTextOption: 1,
consentScope: 'service',
thirdPartyStorageType: 'iframe',
consentIdentityEnabled: false,
initScreenBodyTextOption: 1,
consentOnSafari: false,
lang_: language,
defaultToggleValue: 'off',
displayUi: 'inEU',
displayPersistentConsentLink,
defaultToggleValue: 'off',
initScreenRejectButtonShowing: false,
publisherConsentRestrictionIds: [],
publisherLIRestrictionIds: [],
softOptInEnabled: false,
showSummaryView: true,
persistentConsentLinkLocation: 4,
displayPersistentConsentLink,
uiLayout: 'popup',
publisherLogo,
publisherPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
publisherPurposeLegitimateInterestIds: [2, 7, 8, 10],
publisherSpecialPurposesIds: [1, 2],
publisherFeaturesIds: [],
publisherSpecialFeaturesIds: [],
stacks: [1, 42],
softOptInEnabled: false,
uiLayout: 'popup',
vendorListUpdateFreq: 90,
thirdPartyStorageType: 'iframe',
showSummaryView: true,
persistentConsentLinkLocation: 4,
quantcastAccountId: 'FPBLJYpJgR9Zu',
privacyMode: ['GDPR', 'USP'],
hashCode: 'klt866OJQEpWMQn5tnZBBg',
hashCode: 'viIA/yKcUUmwj5xfSRz5eQ',
publisherCountryCode: 'US',
publisherName,
vendorPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Expand All @@ -68,6 +72,7 @@ const initCMP = (options) => {
uspLspact: 'N',
suppressCcpaLinks: true,
},
nonIabVendorsInfo: {},
})

// Important: the CMP JS apparently must load after the
Expand Down
2 changes: 1 addition & 1 deletion src/qcChoiceModified.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const setUpQuantcastChoice = () => {
const firstScript = document.getElementsByTagName('script')[0]
// cmpScriptElement.async = true
// cmpScriptElement.type = 'text/javascript'
// const cmpVersion = 'https://quantcast.mgr.consensu.org/tcfv2/14/cmp2.js'
// const cmpVersion = 'https://quantcast.mgr.consensu.org/tcfv2/22/cmp2.js'
// cmpScriptElement.src = cmpVersion
window._qevents = window._qevents || []

Expand Down
3 changes: 1 addition & 2 deletions src/qcCmpModified.js

Large diffs are not rendered by default.

0 comments on commit 0067bce

Please sign in to comment.