Skip to content

BaseAd

Inherits: Control

Base class for all ad controls in Flet Ads package.

Raises:

  • AssertionError

    When using this control on a web and/or non-mobile platform.

Properties

Events

Properties#

request #

request: AdRequest = field(
    default_factory=lambda: AdRequest()
)

Targeting information used to fetch an Ad.

unit_id #

unit_id: str

Ad unit ID for this ad.

Events#

on_click #

on_click: ControlEventHandler[BaseAd] | None = None

Called when this ad is clicked.

on_close #

on_close: ControlEventHandler[BaseAd] | None = None

Called when the full screen view has been closed. You should restart anything paused while handling on_open.

on_error #

on_error: ControlEventHandler[BaseAd] | None = None

Called when an ad request failed.

Event handler argument data property contains information about the error.

on_impression #

on_impression: ControlEventHandler[BaseAd] | None = None

Called when an impression occurs on this ad.

on_load #

on_load: ControlEventHandler[BaseAd] | None = None

Called when this ad is loaded successfully.

on_open #

on_open: ControlEventHandler[BaseAd] | None = None

Called when this ad opens up.

A full screen view/overlay is presented in response to the user clicking on an ad. You may want to pause animations and time sensitive interactions.