1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17function generateBid(ad, auction_signals, per_buyer_signals, 18 trusted_bidding_signals, contextual_signals, custom_audience_bidding_signals) { 19 var bid = 5; 20 if (custom_audience_bidding_signals.name === "shoes") { 21 bid = 10; 22 } 23 return {'status': 0, 'ad': ad, 'bid': bid, 'adCost': 1.0 }; 24} 25function reportWin(ad_selection_signals, per_buyer_signals, signals_for_buyer, 26 contextual_signals, custom_audience_reporting_signals) { 27 // Add the address of your reporting server here 28 let reporting_address = '<buyer-reporting-uri>'; 29 // Register beacons 30 let clickUri = reporting_address + '/buyerInteraction?click?adCost=' + contextual_signals.adCost; 31 let viewUri = reporting_address + '/buyerInteraction?view'; 32 const beacons = {'click': clickUri, 'view': viewUri} 33 registerAdBeacon(beacons) 34 return {'status': 0, 'results': {'reporting_uri': 35 reporting_address + '/reportWin?ca=' + custom_audience_reporting_signals.name} }; 36}