Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
CCPA Publisher No Sale Relationships (prebid#1465)
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxNode authored Sep 17, 2020
1 parent 4b64368 commit 2a57582
Show file tree
Hide file tree
Showing 59 changed files with 1,962 additions and 747 deletions.
2 changes: 1 addition & 1 deletion adapters/33across/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Test33AcrossSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/adkernel/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAdkernelAdnSyncer(t *testing.T) {
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/adkernelAdn/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAdkernelAdnSyncer(t *testing.T) {
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/adman/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAdmanSyncer(t *testing.T) {
Consent: "ANDFJDS",
},
CCPA: ccpa.Policy{
Value: "1-YY",
Consent: "1-YY",
},
})

Expand Down
7 changes: 4 additions & 3 deletions adapters/admixer/usersync_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package admixer

import (
"testing"
"text/template"

"github.com/prebid/prebid-server/privacy"
"github.com/prebid/prebid-server/privacy/ccpa"
"github.com/prebid/prebid-server/privacy/gdpr"
"github.com/stretchr/testify/assert"
"testing"
"text/template"
)

func TestAdmixerSyncer(t *testing.T) {
Expand All @@ -22,7 +23,7 @@ func TestAdmixerSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
5 changes: 3 additions & 2 deletions adapters/adtarget/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package adtarget

import (
"fmt"
"github.com/prebid/prebid-server/privacy/ccpa"
"testing"
"text/template"

"github.com/prebid/prebid-server/privacy/ccpa"

"github.com/prebid/prebid-server/privacy"
"github.com/prebid/prebid-server/privacy/gdpr"
"github.com/stretchr/testify/assert"
Expand All @@ -25,7 +26,7 @@ func TestAdtargetSyncer(t *testing.T) {
Consent: "123",
},
CCPA: ccpa.Policy{
Value: "1-YY",
Consent: "1-YY",
},
})

Expand Down
5 changes: 3 additions & 2 deletions adapters/aja/usersync_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package aja

import (
"github.com/prebid/prebid-server/privacy/ccpa"
"testing"
"text/template"

"github.com/prebid/prebid-server/privacy/ccpa"

"github.com/prebid/prebid-server/privacy"
"github.com/prebid/prebid-server/privacy/gdpr"
"github.com/stretchr/testify/assert"
Expand All @@ -23,7 +24,7 @@ func TestAJASyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/avocet/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAvocetSyncer(t *testing.T) {
Consent: "ConsentString",
},
CCPA: ccpa.Policy{
Value: "PrivacyString",
Consent: "PrivacyString",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/beachfront/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestBeachfrontSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/beintoo/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestBeintooSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
13 changes: 7 additions & 6 deletions adapters/consumable/consumable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package consumable
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"

"github.com/mxmCherry/openrtb"
"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/errortypes"
"github.com/prebid/prebid-server/openrtb_ext"
"github.com/prebid/prebid-server/privacy/ccpa"
"net/http"
"net/url"
"strconv"
"strings"
)

type ConsumableAdapter struct {
Expand Down Expand Up @@ -136,9 +137,9 @@ func (a *ConsumableAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *a

gdpr := bidGdpr{}

ccpaPolicy, err := ccpa.ReadPolicy(request)
ccpaPolicy, err := ccpa.ReadFromRequest(request)
if err == nil {
body.CCPA = ccpaPolicy.Value
body.CCPA = ccpaPolicy.Consent
}

// TODO: Replace with gdpr.ReadPolicy when it is available
Expand Down
2 changes: 1 addition & 1 deletion adapters/consumable/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestConsumableSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/datablocks/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDatablocksSyncer(t *testing.T) {
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/emx_digital/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestEMXDigitalSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/engagebdr/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestEngageBDRSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/gamoshi/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestGamoshiSyncer(t *testing.T) {
syncer := NewGamoshiSyncer(syncURLTemplate)
syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{
CCPA: ccpa.Policy{
Value: "anyValue",
Consent: "anyValue",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/gumgum/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestGumGumSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/improvedigital/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestImprovedigitalSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/marsmedia/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMarsmediaSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
24 changes: 12 additions & 12 deletions adapters/nanointeractive/usersync_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package nanointeractive

import (
"github.com/prebid/prebid-server/privacy/ccpa"
"github.com/prebid/prebid-server/privacy/gdpr"
"testing"
"text/template"

"github.com/prebid/prebid-server/privacy/ccpa"
"github.com/prebid/prebid-server/privacy/gdpr"

"github.com/prebid/prebid-server/privacy"
"github.com/stretchr/testify/assert"
)
Expand All @@ -17,16 +18,15 @@ func TestNewNanoInteractiveSyncer(t *testing.T) {
)

userSync := NewNanoInteractiveSyncer(syncURLTemplate)
syncInfo, err := userSync.GetUsersyncInfo(
privacy.Policies{
GDPR: gdpr.Policy{
Signal: "1",
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Value: "1NYN",
},
})
syncInfo, err := userSync.GetUsersyncInfo(privacy.Policies{
GDPR: gdpr.Policy{
Signal: "1",
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Consent: "1NYN",
},
})

assert.NoError(t, err)
assert.Equal(t, "https://ad.audiencemanager.de/hbs/cookie_sync?gdpr=1&consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw&us_privacy=1NYN&redirectUri=http%3A%2F%2Flocalhost%2Fsetuid%3Fbidder%3Dnanointeractive%26gdpr%3D1%26gdpr_consent%3DBONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw%26uid%3D%24UID", syncInfo.URL)
Expand Down
2 changes: 1 addition & 1 deletion adapters/pubmatic/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestPubmaticSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/rhythmone/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestRhythmoneSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
15 changes: 8 additions & 7 deletions adapters/sharethrough/butler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package sharethrough
import (
"encoding/json"
"fmt"
"github.com/mxmCherry/openrtb"
"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/errortypes"
"github.com/prebid/prebid-server/openrtb_ext"
"github.com/prebid/prebid-server/privacy/ccpa"
"net/http"
"net/url"
"regexp"
"strconv"
"time"

"github.com/mxmCherry/openrtb"
"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/errortypes"
"github.com/prebid/prebid-server/openrtb_ext"
"github.com/prebid/prebid-server/privacy/ccpa"
)

const defaultTmax = 10000 // 10 sec
Expand Down Expand Up @@ -97,8 +98,8 @@ func (s StrOpenRTBTranslator) requestFromOpenRTB(imp openrtb.Imp, request *openr
}

usPolicySignal := ""
if usPolicy, err := ccpa.ReadPolicy(request); err == nil {
usPolicySignal = usPolicy.Value
if usPolicy, err := ccpa.ReadFromRequest(request); err == nil {
usPolicySignal = usPolicy.Consent
}

return &adapters.RequestData{
Expand Down
2 changes: 1 addition & 1 deletion adapters/smartadserver/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestSmartadserverSyncer(t *testing.T) {
Consent: "COyASAoOyASAoAfAAAENAfCAAAAAAAAAAAAAAAAAAAAA",
},
CCPA: ccpa.Policy{
Value: "1YNN",
Consent: "1YNN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (s *Syncer) GetUsersyncInfo(privacyPolicies privacy.Policies) (*usersync.Us
syncURL, err := macros.ResolveMacros(*s.urlTemplate, macros.UserSyncTemplateParams{
GDPR: privacyPolicies.GDPR.Signal,
GDPRConsent: privacyPolicies.GDPR.Consent,
USPrivacy: privacyPolicies.CCPA.Value,
USPrivacy: privacyPolicies.CCPA.Consent,
})
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion adapters/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestGetUsersyncInfo(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
}

Expand Down
2 changes: 1 addition & 1 deletion adapters/unruly/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestUnrulySyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/valueimpression/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestValueImpressionSyncer(t *testing.T) {
Consent: "BOPVK28OVJoTBABABAENBs-AAAAhuAKAANAAoACwAGgAPAAxAB0AHgAQAAiABOADkA",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/visx/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestVisxSyncer(t *testing.T) {
Consent: "B",
},
CCPA: ccpa.Policy{
Value: "C",
Consent: "C",
},
})

Expand Down
2 changes: 1 addition & 1 deletion adapters/zeroclickfraud/usersync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestZeroClickFraudSyncer(t *testing.T) {
Consent: "BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
},
CCPA: ccpa.Policy{
Value: "1NYN",
Consent: "1NYN",
},
})

Expand Down
Loading

0 comments on commit 2a57582

Please sign in to comment.