Skip to content

Commit

Permalink
MediaFuse adapter (prebid#1635)
Browse files Browse the repository at this point in the history
* MediaFuse alias

* Syncer and tests

* gvlid

* gvlid

* new mail
  • Loading branch information
GeneGenie authored and shunj-nb committed Nov 8, 2022
1 parent 307f357 commit adb58ed
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 0 deletions.
12 changes: 12 additions & 0 deletions adapters/mediafuse/usersync.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package mediafuse

import (
"text/template"

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

func NewMediafuseSyncer(temp *template.Template) usersync.Usersyncer {
return adapters.NewSyncer("mediafuse", 411, temp, adapters.SyncTypeRedirect)
}
30 changes: 30 additions & 0 deletions adapters/mediafuse/usersync_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package mediafuse

import (
"testing"
"text/template"

"github.com/prebid/prebid-server/privacy"
"github.com/prebid/prebid-server/privacy/gdpr"
"github.com/stretchr/testify/assert"
)

func TestMediafuseSyncer(t *testing.T) {
syncURL := "//sync.hbmp.mediafuse.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D"
syncURLTemplate := template.Must(
template.New("sync-template").Parse(syncURL),
)

syncer := NewMediafuseSyncer(syncURLTemplate)
syncInfo, err := syncer.GetUsersyncInfo(privacy.Policies{
GDPR: gdpr.Policy{
Signal: "0",
},
})

assert.NoError(t, err)
assert.Equal(t, "//sync.hbmp.mediafuse.com/csync?t=p&ep=0&redir=localhost%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D0%26gdpr_consent%3D%26uid%3D%7Buid%7D", syncInfo.URL)
assert.Equal(t, "redirect", syncInfo.Type)
assert.EqualValues(t, 411, syncer.GDPRVendorID())
assert.Equal(t, false, syncInfo.SupportCORS)
}
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func (cfg *Configuration) setDerivedDefaults() {
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLogicad, "https://cr-p31.ladsp.jp/cookiesender/31?r=true&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&ru="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlogicad%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderLunaMedia, "https://api.lunamedia.io/xp/user-sync?redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dlunamedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMarsmedia, "https://dmp.rtbsrv.com/dmp/profiles/cm?p_id=179&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmarsmedia%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24%7BUUID%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMediafuse, "https://sync.hbmp.mediafuse.com/csync?t=p&ep=0&gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmediafuse%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Buid%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderMgid, "https://cm.mgid.com/m?cdsp=363893&adu="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dmgid%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%7Bmuidn%7D")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNanoInteractive, "https://ad.audiencemanager.de/hbs/cookie_sync?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirectUri="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dnanointeractive%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
setDefaultUsersync(cfg.Adapters, openrtb_ext.BidderNinthDecimal, "https://rtb.ninthdecimal.com/xp/user-sync?acctid={aid}&&redirect="+url.QueryEscape(externalURL)+"%2Fsetuid%3Fbidder%3Dninthdecimal%26gdpr%3D{{.GDPR}}%26gdpr_consent%3D{{.GDPRConsent}}%26uid%3D%24UID")
Expand Down Expand Up @@ -845,6 +846,7 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.logicad.endpoint", "https://pbs.ladsp.com/adrequest/prebidserver")
v.SetDefault("adapters.lunamedia.endpoint", "http://api.lunamedia.io/xp/get?pubid={{.PublisherID}}")
v.SetDefault("adapters.marsmedia.endpoint", "https://bid306.rtbsrv.com/bidder/?bid=f3xtet")
v.SetDefault("adapters.mediafuse.endpoint", "http://ghb.hbmp.mediafuse.com/pbs/ortb")
v.SetDefault("adapters.mgid.endpoint", "https://prebid.mgid.com/prebid/")
v.SetDefault("adapters.mobilefuse.endpoint", "http://mfx.mobilefuse.com/openrtb?pub_id={{.PublisherID}}")
v.SetDefault("adapters.mobfoxpb.endpoint", "http://bes.mobfox.com/?c=o&m=ortb")
Expand Down
1 change: 1 addition & 0 deletions exchange/adapter_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func newAdapterBuilders() map[openrtb_ext.BidderName]adapters.Builder {
openrtb_ext.BidderLogicad: logicad.Builder,
openrtb_ext.BidderLunaMedia: lunamedia.Builder,
openrtb_ext.BidderMarsmedia: marsmedia.Builder,
openrtb_ext.BidderMediafuse: adtelligent.Builder,
openrtb_ext.BidderMgid: mgid.Builder,
openrtb_ext.BidderMobfoxpb: mobfoxpb.Builder,
openrtb_ext.BidderMobileFuse: mobilefuse.Builder,
Expand Down
2 changes: 2 additions & 0 deletions openrtb_ext/bidders.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const (
BidderLogicad BidderName = "logicad"
BidderLunaMedia BidderName = "lunamedia"
BidderMarsmedia BidderName = "marsmedia"
BidderMediafuse BidderName = "mediafuse"
BidderMgid BidderName = "mgid"
BidderMobfoxpb BidderName = "mobfoxpb"
BidderMobileFuse BidderName = "mobilefuse"
Expand Down Expand Up @@ -192,6 +193,7 @@ func CoreBidderNames() []BidderName {
BidderLogicad,
BidderLunaMedia,
BidderMarsmedia,
BidderMediafuse,
BidderMgid,
BidderMobfoxpb,
BidderMobileFuse,
Expand Down
11 changes: 11 additions & 0 deletions static/bidder-info/mediafuse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
maintainer:
email: "[email protected]"
capabilities:
app:
mediaTypes:
- banner
- video
site:
mediaTypes:
- banner
- video
26 changes: 26 additions & 0 deletions static/bidder-params/mediafuse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Mediafuse Adapter Params",
"description": "A schema which validates params accepted by the Mediafuse adapter",

"type": "object",
"properties": {
"placementId": {
"type": "integer",
"description": "An ID which identifies this placement of the impression"
},
"siteId": {
"type": "integer",
"description": "An ID which identifies the site selling the impression"
},
"aid": {
"type": "integer",
"description": "An ID which identifies the channel"
},
"bidFloor": {
"type": "number",
"description": "BidFloor, US Dollars"
}
},
"required": ["aid"]
}
2 changes: 2 additions & 0 deletions usersync/usersyncers/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"github.com/prebid/prebid-server/adapters/logicad"
"github.com/prebid/prebid-server/adapters/lunamedia"
"github.com/prebid/prebid-server/adapters/marsmedia"
"github.com/prebid/prebid-server/adapters/mediafuse"
"github.com/prebid/prebid-server/adapters/mgid"
"github.com/prebid/prebid-server/adapters/nanointeractive"
"github.com/prebid/prebid-server/adapters/ninthdecimal"
Expand Down Expand Up @@ -136,6 +137,7 @@ func NewSyncerMap(cfg *config.Configuration) map[openrtb_ext.BidderName]usersync
insertIntoMap(cfg, syncers, openrtb_ext.BidderLogicad, logicad.NewLogicadSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderLunaMedia, lunamedia.NewLunaMediaSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderMarsmedia, marsmedia.NewMarsmediaSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderMediafuse, mediafuse.NewMediafuseSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderMgid, mgid.NewMgidSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderNanoInteractive, nanointeractive.NewNanoInteractiveSyncer)
insertIntoMap(cfg, syncers, openrtb_ext.BidderNinthDecimal, ninthdecimal.NewNinthDecimalSyncer)
Expand Down
1 change: 1 addition & 0 deletions usersync/usersyncers/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestNewSyncerMap(t *testing.T) {
string(openrtb_ext.BidderLogicad): syncConfig,
string(openrtb_ext.BidderLunaMedia): syncConfig,
string(openrtb_ext.BidderMarsmedia): syncConfig,
string(openrtb_ext.BidderMediafuse): syncConfig,
string(openrtb_ext.BidderMgid): syncConfig,
string(openrtb_ext.BidderNanoInteractive): syncConfig,
string(openrtb_ext.BidderNinthDecimal): syncConfig,
Expand Down

0 comments on commit adb58ed

Please sign in to comment.