重要事項:範例中顯示的 Protobuf 訊息,在此處以人類可讀的文字表示。不過,這並不是訊息透過電線傳送的方式。使用 Google 或 OpenRTB Protobuf 格式時,系統只會接受已序列化的 BidResponse 訊息。
您可以使用下列 C++ 程式碼建立及序列化 BidResponse 訊息:
BidResponse bid_response;
// fill in bid response with bid information
string post_response;
if (bid_response.SerializeToString(&post_response)) {
// respond to the POST with post_response as the content
} else {
// return an error to the POST
}
在 BidResponse.seatbid.bid.adm 欄位中使用 HTML 程式碼片段,指定在您自有伺服器上託管的廣告。程式碼片段會封裝在插入網頁的 iFrame 中,因此在載入網頁時,系統會擷取並轉譯廣告。您必須編寫 HTML 程式碼片段,讓廣告 (橫幅或插頁式廣告) 正確顯示在 iFrame 中,並以適當大小顯示在您出價的廣告版位中。
此外,在下列情況下,出價回應中宣告的大小必須與出價要求中完全相符的大小組合相符:
廣告是一般橫幅廣告 (不是影片、原生或插頁式廣告)。
出價者已在出價回應中宣告大小。請求中只要有兩種以上的大小,就必須宣告大小。
插頁式廣告則例外。插頁式廣告的寬度必須至少為螢幕寬度的 50%,高度則至少為螢幕高度的 40%。
您可以使用任何有效的 HTML 程式碼指定 HTML 廣告素材片段,但請注意,在「Create BidResponse message」部分指定 crid 欄位時,請遵守相關限制。這項功能的其中一個用途,就是在擷取自伺服器的網址引數中加入額外資訊,以便在算繪廣告時使用。這樣一來,您就能將曝光次數的任意資料傳回至自己的伺服器。
id:"96Z599PGNvp7Mr99138Fm0"seatbid{bid{id:"NQb32Ge7Rtt84wFn2p8"impid:"1"price:0.153584adid:"test_creative_id_272596"adomain:"google.com"crid:"test_creative_id_272596"cat:"IAB13-7"burl:"https://test.com/imp?id=123456"adm_native{ver:"1.2"assets{id:1required:truetitle{text:"Luxury Mars Cruises"}}assets{id:2required:truedata{value:"Visit the planet in a luxury spaceship."}}assets{id:3required:falsedata{value:"Book today"}}assets{id:4required:truedata{value:"Galactic Luxury Cruises"}}assets{id:5required:trueimg{url:"https://native.test.com/image?id=123456"w:1200h:627}}link{url:"https://www.google.com"}eventtrackers{event:IMPRESSIONmethod:IMGurl:"https://test.com/event?id=123456"}privacy:"https://adssettings.google.com/whythisad?source=display&reasons=OMITTED"}[com.google.doubleclick.bid]{ad_choices_destination_url:"https://test.com/preferences"billing_id:29846056590dsa{behalf:"TEST_ADVERTISER"paid:"TEST_PAYING_ENTITY"adrender:false}}}bid{id:"4vwb23qm6iqU6w6G978"impid:"1"price:0.153584adid:"test_creative_id_272596"adomain:"google.com"crid:"test_creative_id_272596"cat:"IAB21"burl:"https://test.com/imp?id=123456"adm_native{ver:"1.2"assets{id:1required:truetitle{text:"Luxury Mars Cruises"}}assets{id:2required:truedata{value:"Visit the planet in a luxury spaceship."}}assets{id:3required:falsedata{value:"Book today"}}assets{id:4required:truedata{value:"Galactic Luxury Cruises"}}assets{id:5required:trueimg{url:"https://native.test.com/image?id=123456"w:1200h:627}}link{url:"https://www.google.com"}eventtrackers{event:IMPRESSIONmethod:IMGurl:"https://test.com/event?id=123456"}privacy:"https://adssettings.google.com/whythisad?source=display&reasons=OMITTED"}[com.google.doubleclick.bid]{ad_choices_destination_url:"https://test.com/preferences"dsa{behalf:"TEST_ADVERTISER"paid:"TEST_PAYING_ENTITY"adrender:false}}}seat:"4528:1161:591635"group:false}bidid:"hgu4ev7j-ZK929XM0-79f7-0A23O0VN2CFC"cur:"USD"
OpenRTB JSON
顯示範例
{"id":"96Z599PGNvp7Mr99138Fm0","seatbid":[{"bid":[{"id":"NQb32Ge7Rtt84wFn2p8","impid":"1","price":0.153584,"adid":"test_creative_id_272596","adomain":["google.com"],"crid":"test_creative_id_272596","cat":["IAB13-7"],"burl":"https://test.com/imp?id=123456","ext":{"ad_choices_destination_url":"https://test.com/preferences","billing_id":"29846056590","dsa":{"behalf":"TEST_ADVERTISER","paid":"TEST_PAYING_ENTITY","adrender":0}},"adm":"{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"text\":\"Luxury Mars Cruises\"}},{\"id\":2,\"required\":1,\"data\":{\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"required\":0,\"data\":{\"value\":\"Book today\"}},{\"id\":4,\"required\":1,\"data\":{\"value\":\"Galactic Luxury Cruises\"}},{\"id\":5,\"required\":1,\"img\":{\"url\":\"https://native.test.com/image?id=123456\",\"w\":1200,\"h\":627}}],\"link\":{\"url\":\"https://www.google.com\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://test.com/event?id=123456\"}],\"privacy\":\"https://adssettings.google.com/whythisad?source=display&reasons=OMITTED\"}"},{"id":"4vwb23qm6iqU6w6G978","impid":"1","price":0.153584,"adid":"test_creative_id_272596","adomain":["google.com"],"crid":"test_creative_id_272596","cat":["IAB21"],"burl":"https://test.com/imp?id=123456","ext":{"ad_choices_destination_url":"https://test.com/preferences","dsa":{"behalf":"TEST_ADVERTISER","paid":"TEST_PAYING_ENTITY","adrender":0}},"adm":"{\"ver\":\"1.2\",\"assets\":[{\"id\":1,\"required\":1,\"title\":{\"text\":\"Luxury Mars Cruises\"}},{\"id\":2,\"required\":1,\"data\":{\"value\":\"Visit the planet in a luxury spaceship.\"}},{\"id\":3,\"required\":0,\"data\":{\"value\":\"Book today\"}},{\"id\":4,\"required\":1,\"data\":{\"value\":\"Galactic Luxury Cruises\"}},{\"id\":5,\"required\":1,\"img\":{\"url\":\"https://native.test.com/image?id=123456\",\"w\":1200,\"h\":627}}],\"link\":{\"url\":\"https://www.google.com\"},\"eventtrackers\":[{\"event\":1,\"method\":1,\"url\":\"https://test.com/event?id=123456\"}],\"privacy\":\"https://adssettings.google.com/whythisad?source=display&reasons=OMITTED\"}"}],"seat":"4528:1161:591635","group":0}],"bidid":"hgu4ev7j-ZK929XM0-79f7-0A23O0VN2CFC","cur":"USD"}
ad{adslot{id:1max_cpm_micros:158000billing_id:41106584355deal_id:1}click_through_url:"google.com"attribute:70buyer_creative_id:"test_creative_id_251451"advertiser_name:"Google"native_ad{headline:"Luxury Mars Cruises"body:"Visit the planet in a luxury spaceship."call_to_action:"Book today"advertiser:"Galactic Luxury Cruises"image{url:"https://native.test.com/image?id=123456"width:1200height:222}app_icon{url:"https://native.test.com/icon?id=123456"width:512height:512}star_rating:4.300000190734863click_link_url:"https://www.google.com"}impression_tracking_url:"https://test.com/imp?id=123456"impression_tracking_url:"https://test.com/imp?id=123456"event_notification_token:"token"skadn{version:"4.0"network:"l6x39K4z"itunesitem:"731305960"sourceapp:"627009739"fidelities{fidelity_type:STOREKIT_RENDERED_ADSnonce:"9216faff-74a9-4b35-badc-66878c35f67c"timestamp:1728975919221signature:"b0USXkmg02Q3v6p301kYOHG36CCOWWdEo52RHRttB9t8PTNi79qL17E4D6h7UeUSuq479oTK13G2Ev34MJlU86C5vY1SMVw2"}fidelities{fidelity_type:VIEW_THROUGH_ADSnonce:"9216faff-74a9-4b35-badc-66878c35f67c"timestamp:1728975919221signature:"4Cf4NH6239z9f3wa8j6420Z7H0UISYxyxN5720444dkq6457I5FY0Jg8bk1xge2P8YgiDp74l2738136v2g1A8D50331IRm0"}source_identifier:1}click_tracking_urls:"https://google.com/rtb/click?imp_id=55d2112c-4947-4da5-bc37-b79ebf4577dd"advertised_app_id:"APP_ID_OMITTED"app_promotion_type:INSTALLS}processing_time_ms:63
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-03-07 (世界標準時間)。"],[[["Bid responses must be serialized `BidResponse` protocol buffers with the `Content-Type` header set to `application/octet-stream` for Protobuf, and a parsable `BidResponse` is required for each `BidRequest`, while an empty HTTP 204 response signals no bid."],["Each creative needs a unique `crid` (creative ID) limited to 64 bytes, and this ID must be unique across creatives if there are differences in size, declared URL, attributes, vendor types, appearance, behavior, or rendering method."],["Ad characteristics should be declared using `BidResponse.seatbid.bid.apis`, `BidResponse.seatbid.bid.attr`, or `BidResponse.seatbid.bid.ext.attribute`, with specific values indicating VPAID, MRAID, SIZELESS, or PLAYABLE attributes, respectively, and additional attributes from `buyer-declarable-creative-attributes.txt`."],["Responses should remain under 8KB, utilize persistent HTTPS connections with at least a 10-second timeout, and employ `BidResponse.seatbid.bid.burl` or `BidResponse.seatbid.bid.ext.impression_tracking_url` for tracking impressions."],["The `BidResponse` must accurately set creative attributes (`BidResponse.seatbid.bid.attr`), categories (`BidResponse.seatbid.bid.cat`), and advertiser domain (`BidResponse.seatbid.bid.adomain`) or native ad link (`BidResponse.seatbid.bid.adm_native.link.url`), as responses lacking these are discarded."]]],["Applications must respond to each `BidRequest` with a parsable `BidResponse`, using Protobuf or an HTTP 204 for no bids. Creatives are identified by a unique `crid`. Ad attributes, such as VPAID and MRAID, are declared in specific fields. Utilize impression tracking URLs and avoid deprecated fields. Open Bidding bid responses are similar to Authorized Buyers. Ad sizes in the response must match the request. Macros are used in URLs. Publisher requirements are specified in the `BidRequest`. The response must accurately reflect these requirements and provide the accurate ad attributes and links.\n"]]