Server-SidePython SDKUsage

Ad View Event

How to send ad view events with the Audiencelab Python SDK

Use AdData and AppEvent to send an ad view event when the user watches an ad.

Send this event every time a user views an ad in your app.

ad_data = AdData() \
    .set_ad_id("ad_123") \
    .set_name("New Game Ad") \
    .set_source("rewarded_video") \
    .set_media_source("admob") \
    .set_channel("paid") \
    .set_watch_time(4321) \
    .set_reward(True) \
    .set_value(0.00035) \
    .set_currency("usd")

ad_event = AppEvent(client, ad_data, user_data)
try:
    response = ad_event.send()
    print("Ad view event sent.")
except Exception as e:
    print("Error sending ad view event:", e)

Prop

Type

⚡ Value can be estimated ad revenue

Ad view events allow tracking of monetization performance per ad unit, creative, or channel.