Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Trying out openrtb(tutorial?) #89

Closed
emptyr1 opened this issue Jun 6, 2016 · 6 comments
Closed

Trying out openrtb(tutorial?) #89

emptyr1 opened this issue Jun 6, 2016 · 6 comments

Comments

@emptyr1
Copy link

emptyr1 commented Jun 6, 2016

Hi! I'm really interested to try out openrtb. However, I'm not very proficient with Java. Any steps I can follow to setup and running? I have m2e plugin on eclipse.
Also, is openrtb different from google's open bidder?

@bundeskanzler4711
Copy link
Contributor

Hi @modqhx,
if you are not yet familiar with Java, building a Java based SSP or DSP on your own will be a hard thing ;-)
But let me give you some hints.

First of all, to build the openrtb project you need JDK 7, Maven 3.2 and Google Protocol Buffers 2.6.1. Having m2e installed is not enough:

On Eclipse, the latest m2e is recommended but it can't run the code generation step, so you need to run a "mvn install" from the command line after checkout or after any mvn clean.

I don't know any tutorials or howtos there outside using this project. But only to be sure you got right what the openrtb project is about: it is only a library, that helps you implementing the OpenRTB Protocol using JSON (or protobuf) as exchange format. So some bidder implementations uses this library (I'm not sure, if google's open bidder does, but I think so).

If you just want to try out OpenRTB, maybe this project is not a good starting point for you ;-)
Otherwise, try this article

@emptyr1
Copy link
Author

emptyr1 commented Jun 8, 2016

@bundeskanzler4711 Great thanks for replying. I understand. I've decided to create a very simple server which basically generates and broadcasts openrtb json of a user, let's say and send it over the network(http?)-- like a mock exchange.. I wanted to ask, what does a complete bid request look like(the json file I mean)..Does it look something like this: Then I can maybe process it with maybe spark/kafka etc..

{
    "id" : "32a69c6ba388f110487f9d1e63f77b22d86e916b",
    "imp": [
        {
        "id": "1",
        "banner": {
            "h": 250,
            "w": 300,
            "battr": [2,3],
            "btype": [1,3]
            }
        }
    ],
    "site": {
        "id": "102855",
        "name": "Example Site Name",
        "domain": "http://www.example.com",
        "cat" : [ "IAB15", "IAB15-10" ],
        "page": "http://easy.example.com/easy?cu=13824;cre=mu;target=_blank",
        "ref" : "http://refer+url",
        "publisher": {
            "id": "qqwer1234xgfd",
            "name": "site_name",
            "domain": "my.site.com"
        }
    },
    "device": {
        "ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13  (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
        "ip": "192.168.5.5",
        "geo": {
            "lat": 37.789,
            "lon": -122.394,
            "country": "USA",
            "city": "San Francisco",
            "region": "CA",
            "zip" : "94105",
            "type": 2
        }
    },
    "user": {
        "buyeruid" : "89776897686798fwe87rtryt8976fsd7869678",
        "id": "55816b39711f9b5acf3b90e313ed29e51665623f",
        "gender": "M",
        "yob": 1975,
        "customdata": "Data-asdfdwerewr",
        "data": [{
            "id": "pub-demographics",
            "name": "data_name",
            "segment": [{
                "id" : "345qw245wfrtgwertrt56765wert",
                "name" : "segment_name",
                "value": "segment_value"
            }]
        }]
    }
}

The following sample bid response for web-based display contains a single SeatBid object.

Example 3. BidResponse

{
    "id": "eb85349d-03c3-44f4-a77b-824f7221d116",
    "seatbid": [{
        "bid": [{
            "id": "bid1",
            "impid": "eb85349d-03c3-44f4-a77b-824f7221d116",
            "price": 0.1,
            "adm": "<div>Ad Creative</div>",
            "adomain": [
                "http://www.example.com/clickthrough"
            ],
            "crid": "crid_value",
            "nurl": "http://example.com/winnotice?impid={AUCTION_IMP_ID}&auction=${AUCTION_ID}&price=${AUCTION_PRICE}&bidid=${AUCTON_BID_ID}"&bidcur=${AUCTION_CURRENCY}",
            "ext": {
                "brand_id": "brand_val",
                "buyer_id": "buyer_val",
            }
        }]
    }]
}

{
    "id": "eb85349d-03c3-44f4-a77b-824f7221d116",
    "seatbid": [{
        "bid": [{
            "id": "32a69c6ba388f110487f9d1e63f77b22d86e916b",
            "impid": "eb85349d-03c3-44f4-a77b-824f7221d116",
            "price": 0.60000,
            "adid": "529833ce55314b19e8796116",
            "nurl": "http://example.com/win/529833ce55314b19e8796116?won=${AUCTION_PRICE}&impid={AUCTION_IMP_ID}&auction=${AUCTION_ID}&bidid=${AUCTON_BID_ID}",
            "adm": "<iframe src=\"http://example.com/render/529833ce55314b19e8796116\" width=\"300\" height=\"250\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\" leftmargin=\"0\"></iframe>",
            "adomain": [
                "openx.ads.com"
            ],
            "cid": "529833ce55314b19e8796116",
            "crid": "529833ce55314b19e8796116_1385706446"
        }],
        "seat": "772"
    }],
    "cur": "USD"
}

P.s. why do we say openrtb 'protocol'? Isn't it just this json document simply being sent from one server to another over tcp?

@bundeskanzler4711
Copy link
Contributor

bundeskanzler4711 commented Jun 9, 2016

Hi @modqhx,

we call it 'protocol' because the openrtb library is used to implement the (HTTP based) OpenRTB Protocol described in these two documents:

If you are interested in full-size-examples, please have a look into the src/test/resources directory of this project.

These files were built using

I hope this helps you understanding how this library works.

By the way, did you notice the draft for the upcoming OpenRTB version 2.4 with Native 1.1?

@emptyr1
Copy link
Author

emptyr1 commented Jun 11, 2016

@bundeskanzler4711 Thanks for sharing those links :) although I'm still a little fuzzy on the concept. I saw the requestHelper.java code. Eventually its still does come down to an ad exchange server sending, let's say json object to another server over port 80. Not sure why is it hard to simply parse that json on the receiver in real time/or so called 'protocol' and send a response. Another reason I feel its called protocol because the 'keys' in json represent and mean something, and always remain the same when receiving the file.
No?- please correct me if I'm wrong. Learning a lot from you..
The reason I'm asking this, if I do create my 'mock exchange', like a single machine which basically sends a millions of these json objects(which are a user's ad impression) -- to -> my server listening on port 80, parses json/basic filtering(with apache storm/spark) and sends that json back to the server, within 100 ms.
p.s I also realized along with the bidrequest json object, there's also a cookie file being sent everytime, which needs to be sent back to the ad exchange everytime. Although I'm wondering after I win, I send another object, which would be an image over http, would definitely take more than 100 ms to send over

@opinali
Copy link
Contributor

opinali commented Jul 8, 2016

Hi @modqhx, as you figured out the RTB "protocol" is really simple, mostly a single request/response pair on top of HTTP[S]. The real complexity of RTB is in the data model inside the request and response objects, and the logic used in both sides, by exchanges and bidders, both trying to optimize several factors like revenue, impressions/clicks, respect restrictions from publishers and networks, avoid fraud etc. And the operational part of the service can also be tough, in particular a bidder may need to handle tens or hundreds of thousand requests per second and it needs to handle them all very fast and still perform complex bidding logic, so performance is important. The JSON-based protocol allows you to easily handle the messages in Javascript or another dynamically-typed language without a special library, but most people want to use more efficient languages like Java or C++, we also want static typing just because the model is so complex with tons of object types and of fields. This library helps with that, it will make sure messages are valid, also support a binary serialization format that's way more efficient than JSON (this saves a ton of money when one operates at the scale of large RTB exchanges like AdX; may be less relevant for small bidders).

@opinali opinali closed this as completed Jan 10, 2017
@haitui
Copy link

haitui commented Jul 27, 2017

excuse me! Have you installed the opentrb successfully? Can you help me?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants