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

Criteo Bid Adapter: add iframe syncs support #8577

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

afewcc
Copy link
Contributor

@afewcc afewcc commented Jun 17, 2022

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Does this change affect user-facing APIs or examples documented on http://prebid.org?
  • Other

Description of change

Added support for user sync through iframe as possible sync option

Contacts

@patmmccann
Copy link
Collaborator

Please note your failing test @afewcc

@leonardlabat
Copy link
Contributor

Hello @ChrisHuie
I hope your are doing well :)
Any chance to get this one reviewed in the coming days ?
Thanks a lot

@ChrisHuie
Copy link
Collaborator

Hello @ChrisHuie I hope your are doing well :) Any chance to get this one reviewed in the coming days ? Thanks a lot

Should be able to review it in the next couple of days

version: '$prebid.version$'.replace(/\./g, '_'),
};

window.addEventListener('message', function (event) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this leaves a dangling listener each time it's run; imo it should detach itself when it gets the matching requestId back

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also curious: how does the sync figure out which window to message? this is the first time I see this approach and I'm wondering if it needs support from core for the general case (where prebid might be in a window other than top).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the sync frame, we simply try to send the message to window.parent (which should be the one listening to the message as it's the one which dropped the frame)

storage.removeDataFromLocalStorage(name);
}

function hasPurpose1Consent(gdprConsent) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use this utility:

export function hasPurpose1Consent(gdprConsent) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const refererInfo = getRefererInfo();
const origin = 'criteoPrebidAdapter';

if (syncOptions.iframeEnabled && hasPurpose1Consent(gdprConsent)) {
Copy link
Collaborator

@patmmccann patmmccann Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (syncOptions.iframeEnabled) {
is a more typical use of iframe syncs

why are you putting all this code in the adapter instead of the iframe you return

Copy link
Collaborator

@patmmccann patmmccann Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see, you are trying to decorate the sync call with these id's, nevermind

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the hasPurpose1Consent call
We really want the purpose1 to be granted prior to init our user sync as it involves interacting with 1PC the LS to resolve our sync endpoint arguments.

@patmmccann patmmccann merged commit e84e58c into prebid:master Jul 25, 2022
ccorbo pushed a commit to ccorbo/Prebid.js that referenced this pull request Jul 27, 2022
JacobKlein26 pushed a commit to nextmillenniummedia/Prebid.js that referenced this pull request Feb 9, 2023
jorgeluisrocha pushed a commit to jwplayer/Prebid.js that referenced this pull request May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants