Guide for publishers

Keep AdsGram. Add a fallback and stop losing unfilled ad requests.

No single ad network fills every request in every country. When your primary network has no ad, a fallback network can show one instead. Here is how to run CleanAds next to AdsGram in a Telegram Mini App, with code you can paste.

Updated · CleanAds team

Quick answer

  • Keep your current network. Call CleanAds only when it has no ad for a request.
  • Users never see two ads in a row: the fallback runs only if the first ad never appeared.
  • No exclusivity, 70% revenue share, payouts in TON or USDT.

Why a fallback earns more

Every ad network has its own advertisers, and their budgets are spread unevenly across countries, formats and hours. When none of them wants a particular request, the network returns no ad and that moment in your app earns nothing. A second network with different advertisers fills part of those gaps. You keep all the revenue your primary network already makes and add whatever the fallback fills.

This matters most for rewarded ads. A user who taps “Watch an ad for coins” and gets nothing is disappointed, and may not tap again.

Option 1: AdsGram first, CleanAds as fallback

The safest way to start. AdsGram's show() resolves when an ad was watched and rejects when something went wrong. The rejection carries the ad's state. If it never got past load, no ad reached the screen, so it is safe to try CleanAds.

Mini App (script tags)
<script src="https://sad.adsgram.ai/js/sad.min.js"></script>
<script src="https://api.cleanads.ai/sdk/v1.js"></script>
<script>
  const adsgram = window.Adsgram.init({ blockId: "YOUR_ADSGRAM_BLOCK_ID" });
  const cleanads = CleanAds.init({ placementId: "pl_xxx", userId: currentUser.id });

  async function showRewarded() {
    try {
      await adsgram.show();           // watched: grant the reward
      return grantReward();
    } catch (result) {
      // Fall back only if AdsGram never got an ad on screen, so a user is never shown two ads in a row.
      if (result && result.state && result.state !== "load") return continueGame();
    }
    try {
      await cleanads.show();
      grantReward();
    } catch (e) {
      continueGame();                 // no ad anywhere, or closed early
    }
  }
</script>

Option 2: CleanAds first, another network as fallback

CleanAds rejects with a precise reason, so the fallback can tell “no ad” (no_fill, network_error, …) apart from “the user closed the ad early” (closed_early).

TypeScript (npm install @cleanads/sdk)
import { init } from "@cleanads/sdk";

const cleanads = init({ placementId: "pl_xxx", userId: currentUser.id });
const adsgram = window.Adsgram.init({ blockId: "YOUR_ADSGRAM_BLOCK_ID" });

export async function showRewarded(): Promise<boolean> {
  try {
    await cleanads.show();
    return true;                      // grant the reward
  } catch (e: any) {
    // The user saw a CleanAds ad and closed it early: don't show another one.
    if (e?.reason === "closed_early" || e?.reason === "already_showing") return false;
  }
  try {
    await adsgram.show();
    return true;
  } catch {
    return false;
  }
}

How to tell which order is better

  1. Run one order for at least a week so weekday and weekend traffic are both included.
  2. For each network, divide revenue by the number of ad requests you sent it, then multiply by 1,000.
  3. Put the network with the higher revenue per 1,000 requests first. Check again every month; demand changes.

Grant rewards once

With two networks, the safest way to grant valuable rewards is from your server. CleanAds calls your signed reward callback once per completed view. Make sure your client code grants a reward at most once per button tap, whichever network showed the ad.

Start in a few minutes

  1. Create a free publisher account and add your Mini App.
  2. Create a rewarded placement and copy its id (pl_…).
  3. Paste one of the snippets above. New apps receive test ads right away, so you can check the flow before review.

Frequently asked questions

Is CleanAds an AdsGram alternative?

It can be, but you don't have to switch. Most publishers get more revenue by running two networks: one as primary and the other as a fallback for the requests the first one cannot fill.

Can I use CleanAds and AdsGram in the same Mini App?

Yes. CleanAds has no exclusivity. You can call it after another network fails, put it on separate placements, or make it your primary network.

Will users see two ads in a row?

Not with the code on this page. It falls back only when the first network never put an ad on screen (no fill or a loading error). If the user watched or skipped an ad, the fallback is not called.

What is fill rate?

Fill rate is the share of ad requests that return an ad. Every unfilled request is a moment you could have earned from. A second network raises the combined fill rate because the two networks have different advertisers.

Which network should be primary?

Start with your current network as primary and CleanAds as fallback. After a week, compare revenue per 1,000 requests in both dashboards and swap the order if CleanAds earns more.

Start in minutes with $25 in free ad credit.