Skip to content

Commit

Permalink
Deleted the loadtype targeting key. (prebid#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbemiller authored Nov 26, 2018
1 parent d12a421 commit 73ad292
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 69 deletions.
1 change: 0 additions & 1 deletion docs/endpoints/openrtb2/amp.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ A sample response payload looks like this:
"hb_bidder_appnexus": "appnexus",
"hb_cache_id": "420d7329-30e8-4c4e-8eaa-fe937172e4e0",
"hb_cache_id_appnexus": "420d7329-30e8-4c4e-8eaa-fe937172e4e0",
"hb_creative_loadtype": "html",
"hb_pb": "0.50",
"hb_pb_appnexus": "0.50",
"hb_size": "300x250",
Expand Down
19 changes: 3 additions & 16 deletions endpoints/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
"strconv"
"time"

"github.com/golang/glog"
"github.com/julienschmidt/httprouter"
"github.com/mssola/user_agent"
"github.com/prebid/prebid-server/adapters"
"github.com/prebid/prebid-server/cache"
"github.com/prebid/prebid-server/config"
Expand All @@ -21,10 +24,6 @@ import (
"github.com/prebid/prebid-server/pbsmetrics"
pbc "github.com/prebid/prebid-server/prebid_cache_client"
"github.com/prebid/prebid-server/usersync"

"github.com/golang/glog"
"github.com/julienschmidt/httprouter"
"github.com/mssola/user_agent"
)

type bidResult struct {
Expand All @@ -36,18 +35,11 @@ const defaultPriceGranularity = "med"

// Constant keys for ad server targeting for responses to Prebid Mobile
const hbpbConstantKey = "hb_pb"
const hbCreativeLoadMethodConstantKey = "hb_creative_loadtype"
const hbBidderConstantKey = "hb_bidder"
const hbCacheIdConstantKey = "hb_cache_id"
const hbDealIdConstantKey = "hb_deal"
const hbSizeConstantKey = "hb_size"

// hb_creative_loadtype key can be one of `demand_sdk` or `html`
// default is `html` where the creative is loaded in the primary ad server's webview through AppNexus hosted JS
// `demand_sdk` is for bidders who insist on their creatives being loaded in their own SDK's webview
const hbCreativeLoadMethodHTML = "html"
const hbCreativeLoadMethodDemandSDK = "demand_sdk"

func min(x, y int) int {
if x < y {
return x
Expand Down Expand Up @@ -486,11 +478,6 @@ func sortBidsAddKeywordsMobile(bids pbs.PBSBidSlice, pbs_req *pbs.PBSRequest, pr
if hbSize != "" {
kvs[hbSizeConstantKey] = hbSize
}
if bid.BidderCode == "audienceNetwork" {
kvs[hbCreativeLoadMethodConstantKey] = hbCreativeLoadMethodDemandSDK
} else {
kvs[hbCreativeLoadMethodConstantKey] = hbCreativeLoadMethodHTML
}
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions endpoints/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http/httptest"
"testing"

"github.com/mxmCherry/openrtb"
"github.com/prebid/prebid-server/cache/dummycache"
"github.com/prebid/prebid-server/config"
"github.com/prebid/prebid-server/gdpr"
Expand All @@ -19,8 +20,6 @@ import (
metricsConf "github.com/prebid/prebid-server/pbsmetrics/config"
"github.com/prebid/prebid-server/prebid_cache_client"
"github.com/prebid/prebid-server/usersync/usersyncers"

"github.com/mxmCherry/openrtb"
"github.com/spf13/viper"
)

Expand Down Expand Up @@ -149,9 +148,6 @@ func TestSortBidsAndAddKeywordsForMobile(t *testing.T) {
t.Error("Ad server targeting should not be nil")
}
if bid.BidderCode == "audienceNetwork" {
if bid.AdServerTargeting["hb_creative_loadtype"] != "demand_sdk" {
t.Error("Facebook bid should have demand_sdk as hb_creative_loadtype in ad server targeting")
}
if bid.AdServerTargeting["hb_size"] != "300x250" {
t.Error("hb_size key was not parsed correctly")
}
Expand Down
3 changes: 1 addition & 2 deletions exchange/exchangetest/targeting-cache-vast-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"hb_pb": "0.00",
"hb_pb_appnexus": "0.00",
"hb_size": "200x250",
"hb_size_appnexus": "200x250",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "200x250"
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions exchange/exchangetest/targeting-cache-vast.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
"hb_pb": "0.00",
"hb_pb_appnexus": "0.00",
"hb_size": "200x250",
"hb_size_appnexus": "200x250",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "200x250"
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions exchange/exchangetest/targeting-cache-zero.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@
"hb_pb": "0.00",
"hb_pb_appnexus": "0.00",
"hb_size": "200x250",
"hb_size_appnexus": "200x250",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "200x250"
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions exchange/exchangetest/targeting-mobile.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
"hb_bidder_audienceNe": "audienceNetwork",
"hb_pb_audienceNetwor": "0.50",
"hb_size_audienceNetw": "200x250",
"hb_creative_loadtype": "demand_sdk",
"hb_env_audienceNetwo": "mobile-app"
}
}
Expand All @@ -151,8 +150,7 @@
"hb_size": "200x250",
"hb_size_appnexus": "200x250",
"hb_env": "mobile-app",
"hb_env_appnexus": "mobile-app",
"hb_creative_loadtype": "html"
"hb_env_appnexus": "mobile-app"
}
}
}
Expand Down Expand Up @@ -188,8 +186,7 @@
"hb_size": "300x500",
"hb_size_appnexus": "300x500",
"hb_env": "mobile-app",
"hb_env_appnexus": "mobile-app",
"hb_creative_loadtype": "html"
"hb_env_appnexus": "mobile-app"
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions exchange/exchangetest/targeting-no-winners.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@
"targeting": {
"hb_bidder_audienceNe": "audienceNetwork",
"hb_pb_audienceNetwor": "0.50",
"hb_size_audienceNetw": "200x250",
"hb_creative_loadtype": "demand_sdk"
"hb_size_audienceNetw": "200x250"
}
}
}
Expand All @@ -147,8 +146,7 @@
"targeting": {
"hb_bidder_appnexus": "appnexus",
"hb_pb_appnexus": "0.70",
"hb_size_appnexus": "200x250",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "200x250"
}
}
}
Expand Down Expand Up @@ -179,8 +177,7 @@
"targeting": {
"hb_bidder_appnexus": "appnexus",
"hb_pb_appnexus": "0.60",
"hb_size_appnexus": "300x500",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "300x500"
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions exchange/exchangetest/targeting-only-winners.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@
"crid": "creative-4",
"ext": {
"prebid": {
"type": "video",
"targeting": {
"hb_creative_loadtype": "demand_sdk"
}
"type": "video"
}
}
}]
Expand All @@ -144,8 +141,7 @@
"targeting": {
"hb_bidder": "appnexus",
"hb_pb": "0.70",
"hb_size": "200x250",
"hb_creative_loadtype": "html"
"hb_size": "200x250"
}
}
}
Expand Down Expand Up @@ -176,8 +172,7 @@
"targeting": {
"hb_bidder": "appnexus",
"hb_pb": "0.60",
"hb_size": "300x500",
"hb_creative_loadtype": "html"
"hb_size": "300x500"
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions exchange/exchangetest/targeting-with-winners.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@
"targeting": {
"hb_bidder_audienceNe": "audienceNetwork",
"hb_pb_audienceNetwor": "0.50",
"hb_size_audienceNetw": "200x250",
"hb_creative_loadtype": "demand_sdk"
"hb_size_audienceNetw": "200x250"
}
}
}
Expand All @@ -148,8 +147,7 @@
"hb_pb": "0.70",
"hb_pb_appnexus": "0.70",
"hb_size": "200x250",
"hb_size_appnexus": "200x250",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "200x250"
}
}
}
Expand Down Expand Up @@ -183,8 +181,7 @@
"hb_pb": "0.60",
"hb_pb_appnexus": "0.60",
"hb_size": "300x500",
"hb_size_appnexus": "300x500",
"hb_creative_loadtype": "html"
"hb_size_appnexus": "300x500"
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions exchange/targeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ func (targData *targetData) setTargeting(auc *auction, isApp bool) {
targData.addKeys(targets, openrtb_ext.HbDealIdConstantKey, deal, bidderName, isOverallWinner)
}

if bidderName == "audienceNetwork" {
targets[string(openrtb_ext.HbCreativeLoadMethodConstantKey)] = openrtb_ext.HbCreativeLoadMethodDemandSDK
} else {
targets[string(openrtb_ext.HbCreativeLoadMethodConstantKey)] = openrtb_ext.HbCreativeLoadMethodHTML
}

if isApp {
targData.addKeys(targets, openrtb_ext.HbEnvKey, openrtb_ext.HbEnvKeyApp, bidderName, isOverallWinner)
}
Expand Down
11 changes: 1 addition & 10 deletions openrtb_ext/bid.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ const (
// HbBidderConstantKey is the name of the Bidder. For example, "appnexus" or "rubicon".
HbBidderConstantKey TargetingKey = "hb_bidder"
HbSizeConstantKey TargetingKey = "hb_size"

// HbCreativeLoadMethodConstantKey is used exclusively by Prebid Mobile to accomodate Facebook.
// Facebook requires that ads from their network be loaded using their own SDK.
// Other demand sources are happy to let Prebid Mobile use a Webview.
HbCreativeLoadMethodConstantKey TargetingKey = "hb_creative_loadtype"
HbDealIdConstantKey TargetingKey = "hb_deal"
HbDealIdConstantKey TargetingKey = "hb_deal"

// HbCacheKey and HbVastCacheKey store UUIDs which can be used to fetch things from prebid cache.
// Callers should *never* assume that either of these exist, since the call to the cache may always fail.
Expand All @@ -95,10 +90,6 @@ const (
HbCacheKey TargetingKey = "hb_cache_id"
HbVastCacheKey TargetingKey = "hb_uuid"

// These are not keys, but values used by hbCreativeLoadMethodConstantKey
HbCreativeLoadMethodHTML string = "html"
HbCreativeLoadMethodDemandSDK string = "demand_sdk"

// This is not a key, but values used by the HbEnvKey
HbEnvKeyApp string = "mobile-app"
)
Expand Down

0 comments on commit 73ad292

Please sign in to comment.