Ad Network Integrations

Use ad SDK callbacks to feed standardized ad lifecycle and ad revenue events into Attriax without inventing a second analytics vocabulary.

SDK integrations

This section stays intentionally general. For detailed configuration, project-specific diagnostics, release context, and exact disclosure guidance, open the app workspace for your project.

Canonical callback mapping

No matter which ad provider you use, map its callbacks into the same Attriax methods so dashboards stay comparable.

Request or preload begins → recordAdEvent(type: request, ...)
Creative loaded and ready → recordAdEvent(type: load, ...)
Load failure → recordAdEvent(type: load_failed, failureReason: ...)
Fullscreen or placement shown → recordAdEvent(type: show, ...)
Show or display failure → recordAdEvent(type: show_failed, failureReason: ...)
Impression, click, dismiss, and reward callbacks → recordAdEvent(type: impression | click | dismiss | reward, ...) plus recordAdRevenue(...) for paid callbacks

AdMob example

Google Mobile Ads rewarded callbacks mapped into Attriax. Adapt the exact callback types to the SDK version you ship.

Flutter rewarded flow

Track load, show, impression, click, dismiss, show failure, and paid callbacks from the real AdMob lifecycle.

1RewardedAd.load(
2  adUnitId: rewardedAdUnitId,
3  request: const AdRequest(),
4  rewardedAdLoadCallback: RewardedAdLoadCallback(
5    onAdLoaded: (ad) async {
6      await attriax.recordAdEvent(
7        AttriaxAdEventType.load,
8        adNetwork: 'admob',
9        adUnitId: rewardedAdUnitId,
10        adPlacement: 'level_complete',
11        adFormat: 'rewarded',
12      );
13
14      ad.onPaidEvent = (value) {
15        attriax.recordAdRevenue(
16          revenue: value.valueMicros,
17          currency: value.currencyCode,
18          revenueInMicros: true,
19          adNetwork: 'admob',
20          adPlacement: 'level_complete',
21          adFormat: 'rewarded',
22          adType: 'paid_event',
23        );
24      };
25
26      ad.fullScreenContentCallback = FullScreenContentCallback(
27        onAdShowedFullScreenContent: (_) => attriax.recordAdEvent(
28          AttriaxAdEventType.show,
29          adNetwork: 'admob',
30          adUnitId: rewardedAdUnitId,
31          adPlacement: 'level_complete',
32          adFormat: 'rewarded',
33        ),
34        onAdImpression: (_) => attriax.recordAdEvent(
35          AttriaxAdEventType.impression,
36          adNetwork: 'admob',
37          adUnitId: rewardedAdUnitId,
38          adPlacement: 'level_complete',
39          adFormat: 'rewarded',
40        ),
41        onAdClicked: (_) => attriax.recordAdEvent(
42          AttriaxAdEventType.click,
43          adNetwork: 'admob',
44          adUnitId: rewardedAdUnitId,
45          adPlacement: 'level_complete',
46          adFormat: 'rewarded',
47        ),
48        onAdDismissedFullScreenContent: (_) => attriax.recordAdEvent(
49          AttriaxAdEventType.dismiss,
50          adNetwork: 'admob',
51          adUnitId: rewardedAdUnitId,
52          adPlacement: 'level_complete',
53          adFormat: 'rewarded',
54        ),
55        onAdFailedToShowFullScreenContent: (_, error) => attriax.recordAdEvent(
56          AttriaxAdEventType.showFailed,
57          adNetwork: 'admob',
58          adUnitId: rewardedAdUnitId,
59          adPlacement: 'level_complete',
60          adFormat: 'rewarded',
61          failureReason: error.message,
62        ),
63      );
64    },
65    onAdFailedToLoad: (error) => attriax.recordAdEvent(
66      AttriaxAdEventType.loadFailed,
67      adNetwork: 'admob',
68      adUnitId: rewardedAdUnitId,
69      adPlacement: 'level_complete',
70      adFormat: 'rewarded',
71      failureReason: error.message,
72    ),
73  ),
74);

AppLovin MAX example

MAX already exposes most lifecycle and monetization callbacks directly, which makes it a good fit for the standardized Attriax ad methods.

Flutter MAX listener

Keep the exact callback names from your MAX package version, but preserve the same Attriax event mapping.

1class RewardedCallbacks extends MaxRewardedAdListener {
2  RewardedCallbacks(this.attriax);
3
4  final Attriax attriax;
5
6  
7  void onAdLoaded(String adUnitId, MaxAd ad) {
8    attriax.recordAdEvent(
9      AttriaxAdEventType.load,
10      adNetwork: 'applovin_max',
11      adUnitId: adUnitId,
12      adPlacement: 'level_complete',
13      adFormat: 'rewarded',
14    );
15  }
16
17  
18  void onAdLoadFailed(String adUnitId, MaxError error) {
19    attriax.recordAdEvent(
20      AttriaxAdEventType.loadFailed,
21      adNetwork: 'applovin_max',
22      adUnitId: adUnitId,
23      adPlacement: 'level_complete',
24      adFormat: 'rewarded',
25      failureReason: error.message,
26    );
27  }
28
29  
30  void onAdDisplayed(MaxAd ad) {
31    attriax.recordAdEvent(
32      AttriaxAdEventType.show,
33      adNetwork: 'applovin_max',
34      adUnitId: ad.adUnitId,
35      adPlacement: 'level_complete',
36      adFormat: 'rewarded',
37    );
38  }
39
40  
41  void onAdDisplayFailed(MaxAd ad, MaxError error) {
42    attriax.recordAdEvent(
43      AttriaxAdEventType.showFailed,
44      adNetwork: 'applovin_max',
45      adUnitId: ad.adUnitId,
46      adPlacement: 'level_complete',
47      adFormat: 'rewarded',
48      failureReason: error.message,
49    );
50  }
51
52  
53  void onAdRevenuePaid(MaxAd ad) {
54    attriax.recordAdRevenue(
55      revenue: ad.revenue,
56      currency: 'USD',
57      adNetwork: 'applovin_max',
58      adUnitId: ad.adUnitId,
59      adPlacement: 'level_complete',
60      adFormat: 'rewarded',
61    );
62  }
63}

ironSource / LevelPlay example

Unity teams can forward LevelPlay callbacks into the Unity Attriax runtime without changing the callback order that the ad SDK already expects.

Unity rewarded callbacks

Track load, show failure, and reward callbacks at the runtime boundary so scene analytics and ad analytics stay together.

1private async void HandleRewardedLoaded(LevelPlayAdInfo adInfo)
2{
3    await _attriax.RecordAdEventAsync(AttriaxAdEventType.Load, new AttriaxRecordAdEventOptions
4    {
5        AdNetwork = "ironsource_levelplay",
6        AdUnitId = adInfo.AdUnitId,
7        AdPlacement = "level_complete",
8        AdFormat = "rewarded",
9    });
10}
11
12private async void HandleRewardedDisplayFailed(LevelPlayAdError error, LevelPlayAdInfo adInfo)
13{
14  await _attriax.RecordAdEventAsync(AttriaxAdEventType.ShowFailed, new AttriaxRecordAdEventOptions
15    {
16        AdNetwork = "ironsource_levelplay",
17        AdUnitId = adInfo.AdUnitId,
18        AdPlacement = "level_complete",
19        AdFormat = "rewarded",
20        FailureReason = error.ErrorMessage,
21    });
22}
23
24private async void HandleRewardedReward(LevelPlayReward reward, LevelPlayAdInfo adInfo)
25{
26  await _attriax.RecordAdEventAsync(AttriaxAdEventType.Reward, new AttriaxRecordAdEventOptions
27    {
28        AdNetwork = "ironsource_levelplay",
29        AdUnitId = adInfo.AdUnitId,
30        AdPlacement = "level_complete",
31        AdFormat = "rewarded",
32        RewardType = reward.Name,
33        RewardAmount = reward.Amount,
34    });
35}

Admost example

Use the same Attriax method family even when the ad SDK exposes slightly different callback names or mediation wrappers.

Flutter mediation listener

The SDK version can rename listeners, but the mapping stays the same: load, failure, show, dismiss, reward, and paid callbacks go into the standardized Attriax calls.

1admostRewardedListener = AdmostRewardedListener(
2  onLoaded: () => attriax.recordAdEvent(
3    AttriaxAdEventType.load,
4    adNetwork: 'admost',
5    adUnitId: zoneId,
6    adPlacement: 'level_complete',
7    adFormat: 'rewarded',
8  ),
9  onFail: (error) => attriax.recordAdEvent(
10    AttriaxAdEventType.loadFailed,
11    adNetwork: 'admost',
12    adUnitId: zoneId,
13    adPlacement: 'level_complete',
14    adFormat: 'rewarded',
15    failureReason: error.message,
16  ),
17  onShown: () => attriax.recordAdEvent(
18    AttriaxAdEventType.show,
19    adNetwork: 'admost',
20    adUnitId: zoneId,
21    adPlacement: 'level_complete',
22    adFormat: 'rewarded',
23  ),
24  onDismissed: () => attriax.recordAdEvent(
25    AttriaxAdEventType.dismiss,
26    adNetwork: 'admost',
27    adUnitId: zoneId,
28    adPlacement: 'level_complete',
29    adFormat: 'rewarded',
30  ),
31  onRewarded: (reward) => attriax.recordAdEvent(
32    AttriaxAdEventType.reward,
33    adNetwork: 'admost',
34    adUnitId: zoneId,
35    adPlacement: 'level_complete',
36    adFormat: 'rewarded',
37    rewardType: reward.type,
38    rewardAmount: reward.amount,
39  ),
40);

Other popular networks

Unity Ads, Mintegral, Pangle, Meta Audience Network, and similar providers can use the same event vocabulary.

  • Keep provider-specific metadata inside `metadata` only when the field does not already have a standardized Attriax home.
  • Always send the provider or mediation name in `adNetwork` and the placement or zone in `adPlacement` so the ad-events dashboard can group the callbacks cleanly.
  • Send paid callbacks through `recordAdRevenue(...)` even when you also record `recordAdEvent(type: impression, ...)` so delivery metrics and monetization metrics stay visible together.
  • Use `recordAdEvent(type: show_failed, failureReason: ...)` and `recordAdEvent(type: load_failed, failureReason: ...)` to make no-fill and show-time regressions obvious in analytics.