"\nconst simulateDelay = (ms) => {\n var start = new Date().getTime();\n var end = start;\n while(end < start + ms) {\n end = new Date().getTime();\n }\n}\n\n/**\n * Generates a bid of 20 for the frequency capping CA, 10 for the shoes CA, and a bid of 5 otherwise\n */\nfunction generateBid(ad, auction_signals, per_buyer_signals,\n trusted_bidding_signals, contextual_signals, custom_audience_bidding_signals) {\n var bid = 5;\n if (custom_audience_bidding_signals.name === \"shoes\") {\n bid = 10;\n }\n else if (custom_audience_bidding_signals.name === \"freq_cap\") {\n bid = 20;\n }\n simulateDelay(0);\n return {'status': 0, 'ad': ad, 'bid': bid };\n}\n\nfunction reportWin(ad_selection_signals, per_buyer_signals, signals_for_buyer,\n contextual_signals, custom_audience_reporting_signals) {\n // Add the address of your reporting server here\n let reporting_address = 'https://reporting.example.com';\n // Register beacons\n let clickUri = reporting_address + '/buyerInteraction?click';\n let viewUri = reporting_address + '/buyerInteraction?view';\n const beacons = {'click': clickUri, 'view': viewUri};\n registerAdBeacon(beacons);\n simulateDelay(0);\n return {'status': 0, 'results': {'reporting_uri':\n reporting_address + '/reportWin?ca=' + custom_audience_reporting_signals.name} };\n}\n"