android / privacy-sandbox-samples

Apache License 2.0
135 stars 55 forks source link

Apparent of mismatch in the documents related with "generateBid" JS method #102

Open guybashan opened 7 months ago

guybashan commented 7 months ago

It seems like there is a mismatch in the docs in the following URL: https://developer.android.com/design-for-safety/privacy-sandbox/protected-audience#ad_cost

It writes that the generateBid function should return: return {'bid': ..., 'adCost': ...,};

But it seems like the correct way is returning: return {'status': status, 'ad': ad, 'bid': bid };

syntxerror commented 1 month ago

Hi @guybashan The documentation you're pointing to is a specific use case where the goal is to return the cost per click. The adCost is stored in the contextual_signals param for the reportWin function. The goal of the function return is to show this specific use case and you are also correct that your understanding of the return structure is what it seems. If it would help your understanding and help others, would showing the return structure like so help with this:

return {'status': status, 'ad': ad, 'bid': bid, 'adCost': ...,};

This way, we can see that the adCost is acceptable and the documentation will provide context that adCost are stored as a contextual_signals.

Hope this helps.