-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
add quantcast ID submodule #5727
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
713e254
add quantcast ID submodule
mckurt 9cbee3d
Merge remote-tracking branch 'upstream/master'
mckurt 5407f6a
Merge remote-tracking branch 'upstream/master'
mckurt 2184b45
use setCookie in test
mckurt 14fc7c1
add comment for consent signals
mckurt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This module adds QuantcastID to the User ID module | ||
* The {@link module:modules/userId} module is required | ||
* @module modules/quantcastIdSystem | ||
* @requires module:modules/userId | ||
*/ | ||
|
||
import {submodule} from '../src/hook.js' | ||
import { getStorageManager } from '../src/storageManager.js'; | ||
|
||
const QUANTCAST_FPA = '__qca'; | ||
|
||
export const storage = getStorageManager(); | ||
|
||
/** @type {Submodule} */ | ||
export const quantcastIdSubmodule = { | ||
/** | ||
* used to link submodule with config | ||
* @type {string} | ||
*/ | ||
name: 'quantcastId', | ||
|
||
/** | ||
* decode the stored id value for passing to bid requests | ||
* @function | ||
* @returns {{quantcastId: string} | undefined} | ||
*/ | ||
decode(value) { | ||
return value; | ||
}, | ||
|
||
/** | ||
* read Quantcast first party cookie and pass it along in quantcastId | ||
* @function | ||
* @returns {{id: {quantcastId: string} | undefined}}} | ||
*/ | ||
getId() { | ||
// Consent signals are currently checked on the server side. | ||
let fpa = storage.getCookie(QUANTCAST_FPA); | ||
return { id: fpa ? { quantcastId: fpa } : undefined } | ||
} | ||
}; | ||
|
||
submodule('userId', quantcastIdSubmodule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { quantcastIdSubmodule, storage } from 'modules/quantcastIdSystem.js'; | ||
|
||
describe('QuantcastId module', function () { | ||
beforeEach(function() { | ||
storage.setCookie('__qca', '', 'Thu, 01 Jan 1970 00:00:00 GMT'); | ||
}); | ||
|
||
it('getId() should return a quantcast id when the Quantcast first party cookie exists', function () { | ||
storage.setCookie('__qca', 'P0-TestFPA'); | ||
|
||
const id = quantcastIdSubmodule.getId(); | ||
expect(id).to.be.deep.equal({id: {quantcastId: 'P0-TestFPA'}}); | ||
}); | ||
|
||
it('getId() should return an empty id when the Quantcast first party cookie is missing', function () { | ||
const id = quantcastIdSubmodule.getId(); | ||
expect(id).to.be.deep.equal({id: undefined}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that a recent PR tackled the same issue (#5606), but I was still getting errors if the sizes aren't defined inside the banner object. I can move this to a different PR if that'd be better.