Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missena Bid Adapter: add capping support #10746

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Conversation

pdamoc
Copy link
Contributor

@pdamoc pdamoc commented Nov 20, 2023

Type of change

  • Feature

Description of change

Some of our publishing partners requested a mechanism to cap the participation in prebid auctions if the user closed our ad. This is particularly relevant in the context of a page that refreshes the ad auctions periodically (e.g. every 15 seconds).
The PR implements the code that checks for the saved capping information and skips the participation if within the capped time frame.

@@ -53,6 +56,16 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
const capKey = `missena.missena.capper.remove-bubble.${validBidRequests[0]?.params.apiKey}`;
const capping = JSON.parse(storage.getDataFromLocalStorage(capKey));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What sets this in storage - do you have some other script running on the pub page?

If it's not there this will throw an exception, I believe this is why the test run failed. (there's a safeJSONParse you can import from utils.js).

Also, please add some tests for the new logic.

Copy link
Contributor Author

@pdamoc pdamoc Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The storage is set by the renderers we have (when the user is clicking a close button).

I will switch to safeJSONParse and think about a way to test this.

@ChrisHuie ChrisHuie merged commit d70097e into prebid:master Nov 30, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants