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

TCFv2.0 Purpose 7 #5444

Merged
merged 34 commits into from
Aug 13, 2020
Merged

TCFv2.0 Purpose 7 #5444

merged 34 commits into from
Aug 13, 2020

Conversation

Fawke
Copy link
Contributor

@Fawke Fawke commented Jul 1, 2020

Type of change

  • Feature

Description of change

Introduces support to enforce TCFv2.0 Purpose 7 (measurement). For details on the spec, please refer to this doc.

Basically, the idea is to block the analytics adapter that are not given consent. In actual implementation terms, it translates to not calling the enableAnalytics function of the AnalyticsAdapter.js interface.

A way to specify GVL ID for Analytics Adapters.

An analytics adapter needs to be associated with a Gvl ID in order to participate in the enforcement checks. If Gvl ID is undefined, then the Analytics adapter will automatically be disqualified and blocked.

Since, there is currently no specific way to provide Gvl ID for Analytics Adapters, this PR introduces a way to do so. When you are registering your analytics adapter in your myAnalyticsAdapter.js file, you can provide the GVL ID in the following way:

adapterManager.registerAnalyticsAdapter({
  adapter: appnexusAdapter,
  code: 'appnexus',
  gvlid: 32
});

Pass it as a property along with adapter and code.

TCF2 Enforcement Results

An event, tcf2Enforcement will be emitted with the payload,

{
  storageBlocked: ['moduleA', 'moduleB'],
  biddersBlocked: ['moduleB'],
  analyticsBlocked: ['moduleC']
}

which will contain information of all the necessary bidders and modules which are blocked by tcf2. One thing which this event payload does not capture is the enforcement status of Purpose 1, 2 and 7. Although, it can be derived from the payload above, for example, if biddersBlocked array is [], that means purpose 2 is not enforced. But in some cases, it could be misleading. For examples, cases where even though purpose 2 is enforced, but all the bidders are given consent by the user or are present in vendorExceptions will give us an []. Let me know if this detail neccessary, I can modify the payload to look something like:

{
  purpose1: {
    enforced: true,
    modulesBlocked: ['moduleA', 'moduleB']
  },
  purpose2: {
    enforced: true,
    modulesBlocked: [] // maybe all bidders were given consent / or present in vendorExceptions
  },
  purpose7: {
    enforced: false,
    modulesBlocked: []
  }
}

@Fawke Fawke marked this pull request as ready for review July 8, 2020 09:30
@Fawke Fawke changed the title TCFv2.0 Purpose 7 (WIP) TCFv2.0 Purpose 7 Jul 9, 2020
@Fawke Fawke requested a review from bretg July 16, 2020 13:50
@bretg
Copy link
Collaborator

bretg commented Jul 16, 2020

Good work @Fawke - my take is that your minimal analytics proposal is fine:

{
  storageBlocked: ['moduleA', 'moduleB'],
  biddersBlocked: ['moduleB'],
  analyticsBlocked: ['moduleC']
}

Analytics adapters can getConfig({consentManagement}) to inspect the settings if they want more detail.

But will allow analytics providers to weigh in.

@bretg bretg requested a review from robertrmartinez July 16, 2020 15:56
@stale
Copy link

stale bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 1, 2020
@Fawke Fawke added pinned won't be closed by stalebot and removed stale labels Aug 1, 2020
@bretg
Copy link
Collaborator

bretg commented Aug 6, 2020

docs PR prebid/prebid.github.io#2192

@bretg bretg removed the needs docs label Aug 6, 2020
@bretg bretg removed their request for review August 6, 2020 18:35
@Fawke Fawke changed the base branch from tcf-purpose2 to master August 10, 2020 07:32
Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

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

Code looks good.

I will be submitting a change to the Rubicon Analytics adapter alongside this to add our GVL ID, so will test it more thoroughly during that.

$$PREBID_GLOBAL$$.enableAnalytics = function (config) {

// Stores 'enableAnalytics' callbacks for later execution.
const enableAnalyticsCallbacks = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome stuff 👍

Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

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

LGTM.
Can you add one more test for auction end emit event

@Fawke
Copy link
Contributor Author

Fawke commented Aug 12, 2020

LGTM.
Can you add one more test for auction end emit event

@jaiminpanchal27 Added!

@jsnellbaker jsnellbaker merged commit c34786d into master Aug 13, 2020
BrightMountainMediaInc pushed a commit to BrightMountainMediaInc/Prebid.js that referenced this pull request Sep 14, 2020
* TCF v2.0 enforcement

* test/spec/modules/gdprEnforcement_spec.js

* add check for gdpr version

* add logInfo message

* remove comment and store value of PURPOSES in an object

* add gvlid check

* add unit tests for validateRules function

* remove purposeId parameter from validateRules function

* add extra tests

* make failing unit test case pass

* deprecate allowAuctionWithouConsent with tcf 2 workflow

* add extra checks for defaults

* remove tcf 2 test page

* add strict gvlid check

* add comments and shorten log messages

* shorted log messages

* add unit tests for setEnforcementConfig

* add gvlid for alias and gvlMapping support

* remove gvlid check

* add support to add gvlid for aliases

* add enableAnalytics hook

* purpose 7 implementation: 1.hook added 2.new field to set gvlid for analytics adapters

* add enableAnalytics hook

* emit tcf2 events

* fix regression

* modify mechanism of event emitted after auction end

* add unit test for enableAnalyticsHook

* add unit test for auction end event

Co-authored-by: Jaimin Panchal <[email protected]>
BrightMountainMediaInc pushed a commit to BrightMountainMediaInc/Prebid.js that referenced this pull request Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM pinned won't be closed by stalebot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants