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

Zemanta adapter: rename adapter to Outbrain #1797

Merged
merged 1 commit into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions adapters/zemanta/zemanta.go → adapters/outbrain/outbrain.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zemanta
package outbrain

import (
"encoding/json"
Expand All @@ -16,7 +16,7 @@ type adapter struct {
endpoint string
}

// Builder builds a new instance of the Zemanta adapter for the given bidder with the given config.
// Builder builds a new instance of the Outbrain adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) {
bidder := &adapter{
endpoint: config.Endpoint,
Expand All @@ -28,7 +28,7 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
reqCopy := *request

var errs []error
var zemantaExt openrtb_ext.ExtImpZemanta
var outbrainExt openrtb_ext.ExtImpOutbrain
for i := 0; i < len(reqCopy.Imp); i++ {
imp := reqCopy.Imp[i]

Expand All @@ -37,18 +37,18 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
errs = append(errs, err)
continue
}
if err := json.Unmarshal(bidderExt.Bidder, &zemantaExt); err != nil {
if err := json.Unmarshal(bidderExt.Bidder, &outbrainExt); err != nil {
errs = append(errs, err)
continue
}
imp.TagID = zemantaExt.TagId
imp.TagID = outbrainExt.TagId
reqCopy.Imp[i] = imp
}

publisher := &openrtb2.Publisher{
ID: zemantaExt.Publisher.Id,
Name: zemantaExt.Publisher.Name,
Domain: zemantaExt.Publisher.Domain,
ID: outbrainExt.Publisher.Id,
Name: outbrainExt.Publisher.Name,
Domain: outbrainExt.Publisher.Domain,
}
if reqCopy.Site != nil {
siteCopy := *reqCopy.Site
Expand All @@ -60,11 +60,11 @@ func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapte
reqCopy.App = &appCopy
}

if zemantaExt.BCat != nil {
reqCopy.BCat = zemantaExt.BCat
if outbrainExt.BCat != nil {
reqCopy.BCat = outbrainExt.BCat
}
if zemantaExt.BAdv != nil {
reqCopy.BAdv = zemantaExt.BAdv
if outbrainExt.BAdv != nil {
reqCopy.BAdv = outbrainExt.BAdv
}

requestJSON, err := json.Marshal(reqCopy)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zemanta
package outbrain

import (
"testing"
Expand All @@ -9,12 +9,12 @@ import (
)

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderZemanta, config.Adapter{
bidder, buildErr := Builder(openrtb_ext.BidderOutbrain, config.Adapter{
Endpoint: "http://example.com/bid"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}

adapterstest.RunJSONBidderTest(t, "zemantatest", bidder)
adapterstest.RunJSONBidderTest(t, "outbraintest", bidder)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zemanta
package outbrain

import (
"encoding/json"
Expand All @@ -14,7 +14,7 @@ func TestValidParams(t *testing.T) {
}

for _, p := range validParams {
if err := validator.Validate(openrtb_ext.BidderZemanta, json.RawMessage(p)); err != nil {
if err := validator.Validate(openrtb_ext.BidderOutbrain, json.RawMessage(p)); err != nil {
t.Errorf("Schema rejected valid params: %s", p)
}
}
Expand All @@ -27,7 +27,7 @@ func TestInvalidParams(t *testing.T) {
}

for _, p := range invalidParams {
if err := validator.Validate(openrtb_ext.BidderZemanta, json.RawMessage(p)); err == nil {
if err := validator.Validate(openrtb_ext.BidderOutbrain, json.RawMessage(p)); err == nil {
t.Errorf("Schema allowed invalid params: %s", p)
}
}
Expand Down
12 changes: 12 additions & 0 deletions adapters/outbrain/usersync.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package outbrain

import (
"text/template"

"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/usersync"
)

func NewOutbrainSyncer(temp *template.Template) usersync.Usersyncer {
return adapters.NewSyncer("outbrain", temp, adapters.SyncTypeRedirect)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zemanta
package outbrain

import (
"testing"
Expand All @@ -16,7 +16,7 @@ func TestSyncer(t *testing.T) {
template.New("sync-template").Parse(syncURL),
)

syncer := NewZemantaSyncer(syncURLTemplate)
syncer := NewOutbrainSyncer(syncURLTemplate)
syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{
GDPR: gdpr.Policy{
Signal: "A",
Expand Down
12 changes: 0 additions & 12 deletions adapters/zemanta/usersync.go

This file was deleted.

4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ func (cfg *Configuration) setDerivedDefaults() {
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNoBid, "https://ads.servenobid.com/getsync?tek=pbs&ver=1&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dnobid%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOpenx, "https://rtb.openx.net/sync/prebid?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dopenx%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUID%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOneTag, "https://onetag-sys.com/usync/?redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Donetag%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUSER_TOKEN%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderOutbrain, "https://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Doutbrain%26uid%3D__ZUID__")
Copy link
Contributor

@SyntaxNode SyntaxNode Apr 9, 2021

Choose a reason for hiding this comment

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

Should the endpoint and usersync URL still point to zemanta.com?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the URLs stay the same.

setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPubmatic, "https://ads.pubmatic.com/AdServer/js/user_sync.html?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&predirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderPulsepoint, "https://bh.contextweb.com/rtset?pid=561205&ev=1&rurl="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dpulsepoint%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25VGUID%25%25")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderRhythmone, "https://sync.1rx.io/usersync2/rmphb?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Drhythmone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%5BRX_UUID%5D")
Expand Down Expand Up @@ -649,7 +650,6 @@ func (cfg *Configuration) setDerivedDefaults() {
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldlab, "https://ad.yieldlab.net/mr?t=2&pid=9140838&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldlab%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%25%25YL_UID%25%25")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldmo, "https://ads.yieldmo.com/pbsync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldmo%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderYieldone, "https://y.one.impact-ad.jp/hbs_cs?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dyieldone%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZemanta, "http://prebidtest.zemanta.com/usersync/prebidtest?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&cb="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzemanta%26uid%3D__ZUID__")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderZeroClickFraud, "https://s.0cf.io/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&r="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dzeroclickfraud%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7Buid%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderBetween, "https://ads.betweendigital.com/match?bidder_id=pbs&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&callback_url="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dbetween%26gdpr%3D0%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUSER_ID%7D")
}
Expand Down Expand Up @@ -876,6 +876,7 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.onetag.endpoint", "https://prebid-server.onetag-sys.com/prebid-server/{{.PublisherID}}")
v.SetDefault("adapters.openx.endpoint", "http://rtb.openx.net/prebid")
v.SetDefault("adapters.orbidder.endpoint", "https://orbidder.otto.de/openrtb2")
v.SetDefault("adapters.outbrain.endpoint", "https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/")
v.SetDefault("adapters.pangle.disabled", true)
v.SetDefault("adapters.pubmatic.endpoint", "https://hbopenbid.pubmatic.com/translator?source=prebid-server")
v.SetDefault("adapters.pubnative.endpoint", "http://dsp.pubnative.net/bid/v1/request")
Expand Down Expand Up @@ -913,7 +914,6 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.yieldlab.endpoint", "https://ad.yieldlab.net/yp/")
v.SetDefault("adapters.yieldmo.endpoint", "https://ads.yieldmo.com/exchange/prebid-server")
v.SetDefault("adapters.yieldone.endpoint", "https://y.one.impact-ad.jp/hbs_imp")
v.SetDefault("adapters.zemanta.endpoint", "https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/")
v.SetDefault("adapters.zeroclickfraud.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}")

v.SetDefault("max_request_size", 1024*256)
Expand Down
4 changes: 2 additions & 2 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import (
"github.com/prebid/prebid-server/adapters/onetag"
"github.com/prebid/prebid-server/adapters/openx"
"github.com/prebid/prebid-server/adapters/orbidder"
"github.com/prebid/prebid-server/adapters/outbrain"
"github.com/prebid/prebid-server/adapters/pangle"
"github.com/prebid/prebid-server/adapters/pubmatic"
"github.com/prebid/prebid-server/adapters/pubnative"
Expand Down Expand Up @@ -103,7 +104,6 @@ import (
"github.com/prebid/prebid-server/adapters/yieldlab"
"github.com/prebid/prebid-server/adapters/yieldmo"
"github.com/prebid/prebid-server/adapters/yieldone"
"github.com/prebid/prebid-server/adapters/zemanta"
"github.com/prebid/prebid-server/adapters/zeroclickfraud"
"github.com/prebid/prebid-server/openrtb_ext"
)
Expand Down Expand Up @@ -182,6 +182,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderOneTag: onetag.Builder,
openrtb_ext.BidderOpenx: openx.Builder,
openrtb_ext.BidderOrbidder: orbidder.Builder,
openrtb_ext.BidderOutbrain: outbrain.Builder,
openrtb_ext.BidderPangle: pangle.Builder,
openrtb_ext.BidderPubmatic: pubmatic.Builder,
openrtb_ext.BidderPubnative: pubnative.Builder,
Expand Down Expand Up @@ -216,7 +217,6 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderYieldlab: yieldlab.Builder,
openrtb_ext.BidderYieldmo: yieldmo.Builder,
openrtb_ext.BidderYieldone: yieldone.Builder,
openrtb_ext.BidderZemanta: zemanta.Builder,
openrtb_ext.BidderZeroClickFraud: zeroclickfraud.Builder,
}
}
4 changes: 2 additions & 2 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const (
BidderOneTag BidderName = "onetag"
BidderOpenx BidderName = "openx"
BidderOrbidder BidderName = "orbidder"
BidderOutbrain BidderName = "outbrain"
BidderPangle BidderName = "pangle"
BidderPubmatic BidderName = "pubmatic"
BidderPubnative BidderName = "pubnative"
Expand Down Expand Up @@ -177,7 +178,6 @@ const (
BidderYieldlab BidderName = "yieldlab"
BidderYieldmo BidderName = "yieldmo"
BidderYieldone BidderName = "yieldone"
BidderZemanta BidderName = "zemanta"
BidderZeroClickFraud BidderName = "zeroclickfraud"
)

Expand Down Expand Up @@ -254,6 +254,7 @@ func CoreBidderNames() []BidderName {
BidderOneTag,
BidderOpenx,
BidderOrbidder,
BidderOutbrain,
BidderPangle,
BidderPubmatic,
BidderPubnative,
Expand Down Expand Up @@ -288,7 +289,6 @@ func CoreBidderNames() []BidderName {
BidderYieldlab,
BidderYieldmo,
BidderYieldone,
BidderZemanta,
BidderZeroClickFraud,
}
}
Expand Down
15 changes: 15 additions & 0 deletions openrtb_ext/imp_outbrain.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package openrtb_ext

// ExtImpOutbrain defines the contract for bidrequest.imp[i].ext.outbrain
type ExtImpOutbrain struct {
Publisher ExtImpOutbrainPublisher `json:"publisher"`
TagId string `json:"tagid"`
BCat []string `json:"bcat"`
BAdv []string `json:"badv"`
}

type ExtImpOutbrainPublisher struct {
Id string `json:"id"`
Name string `json:"name"`
Domain string `json:"domain"`
}
15 changes: 0 additions & 15 deletions openrtb_ext/imp_zemanta.go

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Zemanta Adapter Params",
"description": "A schema which validates params accepted by the Zemanta adapter",
"title": "Outbrain Adapter Params",
"description": "A schema which validates params accepted by the Outbrain adapter",

"type": "object",
"properties": {
Expand Down
4 changes: 2 additions & 2 deletions usersync/usersyncers/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import (
"github.com/prebid/prebid-server/adapters/nobid"
"github.com/prebid/prebid-server/adapters/onetag"
"github.com/prebid/prebid-server/adapters/openx"
"github.com/prebid/prebid-server/adapters/outbrain"
"github.com/prebid/prebid-server/adapters/pubmatic"
"github.com/prebid/prebid-server/adapters/pulsepoint"
"github.com/prebid/prebid-server/adapters/rhythmone"
Expand Down Expand Up @@ -87,7 +88,6 @@ import (
"github.com/prebid/prebid-server/adapters/yieldlab"
"github.com/prebid/prebid-server/adapters/yieldmo"
"github.com/prebid/prebid-server/adapters/yieldone"
"github.com/prebid/prebid-server/adapters/zemanta"
"github.com/prebid/prebid-server/adapters/zeroclickfraud"
"github.com/prebid/prebid-server/config"
"github.com/prebid/prebid-server/openrtb_ext"
Expand Down Expand Up @@ -153,6 +153,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync
insertIntoMap(cfg, syncers, openrtb_ext.BidderNinthDecimal, ninthdecimal.NewNinthDecimalSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderNoBid, nobid.NewNoBidSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderOneTag, onetag.NewSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderOutbrain, outbrain.NewOutbrainSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderOpenx, openx.NewOpenxSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderPubmatic, pubmatic.NewPubmaticSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderPulsepoint, pulsepoint.NewPulsepointSyncer)
Expand Down Expand Up @@ -181,7 +182,6 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync
insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldlab, yieldlab.NewYieldlabSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldmo, yieldmo.NewYieldmoSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderYieldone, yieldone.NewYieldoneSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderZemanta, zemanta.NewZemantaSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderZeroClickFraud, zeroclickfraud.NewZeroClickFraudSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderBetween, between.NewBetweenSyncer)

Expand Down
2 changes: 1 addition & 1 deletion usersync/usersyncers/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestNewSyncerMap(t *testing.T) {
string(openrtb_ext.BidderNoBid): syncConfig,
string(openrtb_ext.BidderOneTag): syncConfig,
string(openrtb_ext.BidderOpenx): syncConfig,
string(openrtb_ext.BidderOutbrain): syncConfig,
string(openrtb_ext.BidderPubmatic): syncConfig,
string(openrtb_ext.BidderPulsepoint): syncConfig,
string(openrtb_ext.BidderRhythmone): syncConfig,
Expand Down Expand Up @@ -96,7 +97,6 @@ func TestNewSyncerMap(t *testing.T) {
string(openrtb_ext.BidderYieldlab): syncConfig,
string(openrtb_ext.BidderYieldmo): syncConfig,
string(openrtb_ext.BidderYieldone): syncConfig,
string(openrtb_ext.BidderZemanta): syncConfig,
string(openrtb_ext.BidderZeroClickFraud): syncConfig,
},
}
Expand Down