function scoreAd(ad, bid, auction_config, seller_signals, trusted_scoring_signals, contextual_signal, custom_audience_scoring_signals) { if (!ad.metadata.isRealAd) { return {'status': 0, 'score': 0 }; } const custom_audiences = new Set(); for (const scoring_signal of custom_audience_scoring_signals) { custom_audiences.add(scoring_signal.name) } const targetingCAs = ad.metadata.targetingCAs; for (const targetingCA of targetingCAs) { if (custom_audiences.has(targetingCA)) { return {'status': 0, 'score': bid + 30 }; } else { return {'status': 0, 'score': bid }; } } } function reportResult(ad_selection_config, render_uri, bid, contextual_signals) { let reporting_address = 'https://reporting.example.com'; let clickUri = reporting_address + '/sellerInteraction?click'; let viewUri = reporting_address + '/sellerInteraction?view'; const beacons = {'click': clickUri, 'view': viewUri}; registerAdBeacon(beacons); return {'status': 0, 'results': {'signals_for_buyer': '{\signals_for_buyer\ : 1}' , 'reporting_uri': reporting_address + 'reportResult?render_uri=' + render_uri + '?bid=' + bid } }; }