Server-SideNodeJS SDKUsage

Ad View Event

Track when rewarded or interstitial ads are being viewed

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.

import { AdData, AppEvent } from "audiencelab_nodejs_sdk";
const adViewEventData = new AdData()
  .setAdId("ad_123")
  .setName("New Game Ad")
  .setSource("rewarded_video")
  .setMediaSource("admob")
  .setChannel("paid")
  .setWatchTime(4321)
  .setReward(true)
  .setValue(0.00035)
  .setCurrency("usd");

const adEvent = new AppEvent(client, adViewEventData, userData);

await adEvent.send().catch((error) => {
  console.error("Error sending ad event:", error);
});
PropTypeDefault
currency
string
-
value
double
-
channel
string
-
media_source
string
-
reward
bool
-
watch_time
int
-
source
string
-
name
string
-
ad_id
string
-

⚡ Value can be estimated ad revenue

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