Skip to main content

BaseAd

Base class for all Ad controls.

This class defines shared ad request and lifecycle event properties for concrete ad controls/services.

Raises:

Inherits: BaseControl

Properties

  • request - Targeting information used to fetch an Ad.
  • unit_id - Ad unit ID for this ad.

Events

  • on_click - Called when this ad is clicked.
  • on_close - Called when the full screen view has been closed.
  • on_error - Called when an ad request failed.
  • on_impression - Called when an impression occurs on this ad.
  • on_load - Called when this ad is loaded successfully.
  • on_open - Called when this ad opens up.

Properties

requestclass-attributeinstance-attribute

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

Targeting information used to fetch an Ad.

unit_idinstance-attribute

unit_id: str

Ad unit ID for this ad.

Events

on_clickclass-attributeinstance-attribute

on_click: Optional[ControlEventHandler[BaseAd]] = None

Called when this ad is clicked.

on_closeclass-attributeinstance-attribute

on_close: Optional[ControlEventHandler[BaseAd]] = None

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

on_errorclass-attributeinstance-attribute

on_error: Optional[ControlEventHandler[BaseAd]] = None

Called when an ad request failed.

Event handler argument data property contains information about the error.

on_impressionclass-attributeinstance-attribute

on_impression: Optional[ControlEventHandler[BaseAd]] = None

Called when an impression occurs on this ad.

on_loadclass-attributeinstance-attribute

on_load: Optional[ControlEventHandler[BaseAd]] = None

Called when this ad is loaded successfully.

on_openclass-attributeinstance-attribute

on_open: Optional[ControlEventHandler[BaseAd]] = 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.