Skip to content

Callback for "not in viewport" and such. #102

Description

@loqtor

Hey,

More an enhancement than an issue probably, but I think that it'd be nice if the library gave you a way to know when the ad was not rendered because of reasons unrelated to it being empty or the script not being loaded.

The case I'm considering is either when the ad is not in viewport or the slot that matches the current viewport size is not properly defined.

The reason I'm raising this is because in my app the ads come from the API and one of them wasn't rendering, even though I had not changed anything on my end.

So, I started debugging and I noticed that one of the slots was empty, but Bling was not actually letting me know that the ad could not be rendered.

The change I'm thinking of is just having a prop that's called onError. It'd pass as a parameter an errorType (i.e.: OUT_OF_PAGE_ERROR when isInViewport is false, SLOT_ERROR when the slots are not properly defined) and you can then do whatever you need based on the type of error that took place.

I hope that made sense. Happy to send a pull request if you find it interesting.

Cheers!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions