1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
content / test / data / interest_group / bidding_logic_register_ad_macro.js [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Basic generate bid script that offers a bid of 1 using the first ad's
// `renderURL` and, if present, the first adComponent's `renderURL`.
function generateBid(interestGroup, auctionSignals, perBuyerSignals,
trustedBiddingSignals, browserSignals) {
const ad = interestGroup.ads[0];
// `auctionSignals` controls whether or not component auctions are allowed.
let allowComponentAuction =
typeof auctionSignals === 'string' &&
auctionSignals.includes('bidderAllowsComponentAuction');
let result = {
'ad': ad, 'bid': 1, 'render': ad.renderURL,
'allowComponentAuction': allowComponentAuction
};
if (interestGroup.adComponents && interestGroup.adComponents[0])
result.adComponents = [interestGroup.adComponents[0].renderURL];
return result;
}
function reportWin(auctionSignals, perBuyerSignals, sellerSignals,
browserSignals) {
registerAdMacro("MACRO_A", "value_old_a");
registerAdMacro("MACRO_B", "value_b");
registerAdMacro("MACRO_A", "value_a");
registerAdMacro("MACRO_C", "value_c");
}