LiaDevelopers

Concepts

Full screen ads in three formats, played by Lia and paced so nobody is flooded. Your server can check that a rewarded video was really watched before it gives anything.

#Three formats

FormatWhat it isWhen to use it
rewardedA video the person chooses to watch, for something in return."Watch a video for a second chance."
rewardedInterstitialLia offers it first, with Watch and Skip, then plays it for a reward.A reward at a natural break, without your own button.
interstitialA full screen ad between moments, with nothing in return.Between rounds or levels. Lia paces these.

Your page asks with Lia.showAd({ format }), or the shortcuts Lia.showRewardedAd(), Lia.showRewardedInterstitialAd() and Lia.showInterstitialAd(). Lia loads and plays the ad over your app, with its own loader while it loads, and pauses your app until it's closed.

#What you get back

Every ad call answers once the ad is closed:

JSON
{ "watched": true, "shown": true, "adId": "ad_8e1c4b0f2a9d47c6b3e15a07" }
FieldMeaning
watchedA rewarded video was watched to the end. Give the reward. Always false for an interstitial.
shownAn ad went on screen.
adIdThe ad's id, for your server to check. Present when watched is true, and when an interstitial was shown.
reasonWhy there's no reward, when watched is false.

The reasons you'll see:

ReasonMeaning
cancelledThey closed the video before the end.
skippedThey chose Skip when Lia offered a rewarded interstitial.
no_adNo ad was ready to show.
too_soonAn interstitial, and it isn't its turn yet.
failedLia couldn't record the view.
Anything elseA connection or server problem, such as network.

If a rewarded video stops playing partway because of a problem on the phone, Lia counts it as watched so nobody loses a reward over a broken ad.

#Pacing

Interstitials are paced by Lia, together with Lia's own ads: one has to wait a few minutes after the last full screen ad, and only so many show a day. When it isn't their turn, showInterstitialAd() answers straight away with reason: "too_soon" and nothing is shown. Just carry on. Ask at every natural break and Lia decides.

Rewarded videos aren't paced, because people choose them.

#Checking on your server

For any reward that matters, don't take the page's watched: true on its word. Send the adId to your server, and have it ask Lia with POST /ads/verify:

JSON
{ "adId": "ad_8e1c4b0f2a9d47c6b3e15a07", "playerId": "p_3f9c0a6d1b2e4f5a6b7c", "watched": true, "watchedAt": 1761998400000 }

Check that watched is true and the playerId is the player asking. Lia doesn't mark an ad as used, so pay each adId once yourself: using ad:<adId> as your reward key does it for you. Rewarded ads that pay shows the whole flow.

#Following along

Pass onState to hear each stage, or listen to every ad with Lia.onAd(fn):

JavaScript
Lia.showRewardedAd({
  onState: function (state) { // "loading", "showing", "closed"
    if (state === "loading") pauseMusic();
    if (state === "closed") resumeMusic();
  },
});

#What you earn

You get 50% of what the ads in your app earn. Lia counts every ad your app shows and what it earns, and pays your part monthly into your own Lia balance, with your share of sales. See Getting paid.

Type to search every page, method and endpoint.