prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
433 stars 739 forks source link

Open RTB: Add currency support #280

Closed sandraleon closed 5 years ago

sandraleon commented 6 years ago

This issue is to track adding currency support in Prebid Server.

There will be a new currency object located under bidrequest.ext:

    "currency": {
        "rates": {
            "USD": {
                "JPY": 110
            }
        }
    }

The ad server currency must be set either in bidrequest.cur (must be one ISO 4217 alpha codes string in array)

    "cur": ["USD"],

or in config file

    "ad_server_currency": "USD",

The currency specified in the bid request will take precedence.

Bidders who support multiple currencies will have to specify the currency for their bids. The currency set (in the request or config) will be provided to bidders so that they can pass that info on to their bidder servers.

Bid price gets converted based on conversion rates available. Conversion rates can be provided in the bid request as shown above. If rates are not provided there, the latest conversion rates will be fetched.

benjaminch commented 4 years ago

Hello @mlapeyre3 !

Actually the module is implemented and supports currencies conversions by default (unless explicitly turned in config). You should be able to have a look at the current rates via admin port: /currency/rates

Cheers

mlapeyre3 commented 4 years ago

Hello @benjaminch,

Thanks for your answer! Well, that is weird because I don't see our EUR bids being converted to USD. For example on the auction for an AMP page: https://prebid.adnxs.com/pbs/v1/openrtb2/amp?tag_id=15029233&w=33.... Prebid Server is sending back a bid at 9cts from us (hb_pb_smartadserver: "0.09"). If we look at our bidResponse, we answered with:

"price": 0.0940969131029020132112983414,
"cur": "EUR",

which would lead to 0.11 USD

That is why I think our 0.09 EUR is considered as a 0.09 USD by Prebid Server.

How can I make sure our price is properly converted to USD? Thanks!

hhhjort commented 4 years ago

Did the openrtb request specify USD as the currency? PBS will convert to the requested currency, or USD if no currency was specified (the default currency).

mlapeyre3 commented 4 years ago

Hey @hhhjort,

From what I can see in the debug mode of Prebid Server, the bidRequest we received was:

{
    "id": "/5966054/CasaEGiardino/CasaEGiardino_amp_ATF",
    "imp": [
        {
            "id": "/5966054/CasaEGiardino/CasaEGiardino_amp_ATF",
            "banner": {
                "format": [
                    {
                        "w": 336,
                        "h": 280
                    },
                    {
                        "w": 300,
                        "h": 250
                    },
                    {
                        "w": 336,
                        "h": 280
                    }
                ]
            },
            "tagid": "/5966054/CasaEGiardino/CasaEGiardino_amp_ATF",
            "secure": 1,
            "ext": {
                "bidder": {
                    "networkId": 1933,
                    "pageId": 766926,
                    "formatId": 59755,
                    "siteId": 145172
                }
            }
        }
    ],
    "site": {
        "domain": "www.casaegiardino.it",
        "page": "https://www.casaegiardino.it/consigli/fornetto-ad-aria-come-scegliere-i-modelli-migliori-in-commercio.php",
        "publisher": {
            "id": "1933"
        },
        "ext": {
            "amp": 1
        }
    },
    "device": {
        "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36",
        "ip": "81.185.162.0"
    },
    "user": {
        "buyeruid": "1913174509097796176"
    },
    "test": 1,
    "at": 1,
    "tmax": 1000,
    "ext": {
        "prebid": {
            "cache": {
                "bids": {},
                "vastxml": null
            },
            "targeting": {
                "pricegranularity": {
                    "precision": 2,
                    "ranges": [
                        {
                            "min": 0,
                            "max": 20,
                            "increment": 0.01
                        }
                    ]
                },
                "includewinners": true,
                "includebidderkeys": true,
                "includebrandcategory": null,
                "includeformat": false,
                "durationrangesec": null
            }
        }
    }
}

So ... no currency signal here! On my side I will make sure we bid in USD (default currency then) when we don't receive any currency in the bidRequest :)

benjaminch commented 4 years ago

Yep @mlapeyre3 OpenRTB states that default currency is USD if not set :)