Introduction
Sites with infinite scroll (news feeds, listicles, image galleries, product streams) traditionally struggle with ads. Fixed placement IDs run out as new content loads. Naïve implementations pile every ad at the bottom instead of inside the flow. Frameworks that lazy-load content need careful handoff to make ads render at the right moment.
Ezoic solves this with id-less showAds calls. Each time your site appends a new batch of content, you make one showAds call anchored to an element in that batch. Ezoic handles the rest: it claims a generated placement id, renders the ad inside the flow directly after the anchor, and (once every mapped id on the page is in use) automatically destroys the oldest id-less placeholder and reuses its id. Calls never fail from id exhaustion, and the ad density scales cleanly with the content.
The short version of the value: ads render inside your content as it grows, with no dashboard setup, no manual id management, and no upper cap on the number of ads.
Instructions
Setup has two parts: standard Ezoic JavaScript integration on your page, and one showAds call per batch of content you append.
Prerequisite
Your site must have the standard Ezoic JavaScript integration in place. If you haven't set that up yet, see JavaScript Integration for non-WordPress Sites or the Ezoic WordPress Plugin JavaScript Integration Guide.
One showAds Call Per Batch
Each time your site appends new content to the page, make a single id-less showAds call that passes the last element of the batch as its anchor:
<script>
window.ezstandalone.cmd.push(function () {
ezstandalone.showAds({
sizes: "300x250",
anchor: lastParagraphInBatch
});
});
</script>
The ad renders inside the flow immediately after the anchor element. Because you're passing an anchor rather than a placeholder id, you don't need to pre-configure anything in the Ezoic dashboard.
That's It
Ezoic manages the rest automatically:
- Each
showAdscall claims a generated placement id from your site's mapped pool. - Once every mapped id is in use, the resolver destroys the oldest id-less placeholder and reuses its id for the new call. Calls never fail from id exhaustion.
- Ads render inside your content as it grows, matching the reader's scroll position.
For the deeper reference material (dynamic content handling, event hooks, edge cases), see the Dynamic Content — Infinite Scroll section of the Ezoic docs. A live working example (with copyable source and a ?burst=120 mode for automated testing) is at examples.ezoic.com/idless/infinite.
FAQs
Is there a maximum number of ads I can show?
No. Once every mapped placement id is in use, the resolver recycles the oldest id-less placeholder rather than failing. The ad count scales with your content.
Do I need to pre-configure placeholders in the dashboard for this?
No. Id-less showAds calls don't require any dashboard setup. Ezoic assigns and manages the ids automatically.
Can I use different ad sizes per device?
Yes. Pass mobile_sizes, desktop_sizes, and tablet_sizes (any combination) alongside a default sizes:
ezstandalone.showAds({
mobile_sizes: ["300x250", "336x280"],
desktop_sizes: ["728x90", "970x250"],
anchor: lastParagraphInBatch
});
Does this work with React, Next.js, Nuxt, Astro, or other frameworks?
Yes. Any framework that renders on the client and appends content dynamically can call ezstandalone.showAds() with an anchor element. For framework-specific patterns (particularly around SSR and route transitions), see the Framework SDKs documentation and the Next.js guide.
What if I want the ad to render somewhere other than immediately after the anchor?
Wrap the anchor element accordingly, or use the CSS selector pattern documented in the Ezoic Ads implementation guide. The ad renders inside the matched element.