Understanding Prebid.js Ad Unit Refresh for Infinite Scroll and Individual Slots

Ad refresh is vital for publishers who want to maximize revenue on long-form pages, especially those with infinite scroll or dynamic content. But simply reloading ads can easily lead to technical pitfalls—especially with header bidding, where improper refresh logic can cause outdated bids to be recycled or revenues to stagnate.

This post breaks down how to correctly implement individual ad unit refresh with Prebid.js, why it matters for user experience and revenue, and where publishers most often get it wrong. Whether you run a news site or a high-profile vertical, mastering this feature can directly increase your ad yield.

The Role of Ad Unit Refresh in Modern Publishing

In an era of endless content feeds and infinite scroll, static ad placements leave revenue on the table. Ad unit refresh enables publishers to load new, competitive demand into existing slots, keeping inventory fresh for both users and advertisers. However, with programmatic and header bidding, each refresh needs careful orchestration: bidding requests, targeting updates, and ad server sync must all align for optimal results.

Revenue Opportunities with Refresh

Regularly reloading ads—done correctly—significantly increases viewable impressions. For infinite scroll pages, each triggered refresh is a chance to tap additional bid demand. With Prebid.js, controlled refresh means you can unlock this opportunity without risking policy violations (e.g., with Google Ad Manager) or serving stale creative.

Example: On an infinite scroll news site, each time a user scrolls past a certain point, you trigger a refresh on the visible ad unit. Every refresh is a new auction, potentially at a new price.

Correct Header Bidding Flow for Individual Ad Unit Refresh

The technical heart of a proper refresh is a new, clean auction. If publishers simply call the ad server’s `refresh()` method without updating header bidding targeting, old bid data is reused, leading to repeated, stale ad creative and lost auction competition.

How Prebid.js Manages Individual Refreshes

To refresh properly, Prebid.js requires these steps for the ad unit:
– Request new bids using `pbjs.requestBids()` for the specific ad slot.
– After bids return, set updated targeting with `pbjs.setTargetingForGPTAsync()`.
– Only then call `googletag.pubads().refresh([slot])` for the intended slot.

If you skip the bid request or targeting update, Google Ad Manager receives the old `hb_` keys, and you essentially re-serve the last winning creative—not a new auction.

Common Pitfalls: Stale Bids, Overlapping Auctions, and Ad Quality

Even experienced ad ops teams can trip up auto-refresh if the process doesn’t enforce a full cycle. The most frequent error: triggering page-level ad refresh (via GAM or custom JavaScript) without invalidating previous Prebid.js targeting.

Outcomes include: old bids being served repeatedly, inventory undervalued due to lack of new competition, or, in worse cases, ad slot breakage if page state desynchronizes.

Example Mistake: Auto-Refresh Gone Wrong

If a publisher only triggers `googletag.pubads().refresh()` without running a new Prebid.js auction, the same winner can be shown for several refreshes—ad fatigue for users and advertisers. To avoid this:
– Always make sure `pbjs.requestBids()` is called, followed by `pbjs.setTargetingForGPTAsync()` before the refresh.
– Routinely check auction timings; avoid requesting new bids too frequently (to comply with ad policies and avoid impression spam).

Best Practices and Implementation Tips

A robust refresh implementation not only improves fill and CPM but also reduces troubleshooting headaches. Build your logic so that only the units visible or reaching user attention thresholds are refreshed, and always clean up old bid targeting before re-auctioning the slot.

Sample Implementation Flow

1. User scrolls to a point triggering refresh logic on ad slot ‘A’.
2. `pbjs.requestBids({ adUnitCodes: [‘A’] })` runs.
3. In the bidsBackHandler, call `pbjs.setTargetingForGPTAsync([‘A’])`.
4. Then, call `googletag.pubads().refresh([A])` for that slot only.
5. Monitor performance and adjust refresh timing based on engagement signals, not arbitrary intervals.

What this means for publishers

Getting refresh wrong can quietly erode your ad revenue and create reporting confusion. Proper, targeted refresh ensures every impression sent to your ad server is monetized at true market value and adheres to platform policies. Teams that pay attention to auction lifecycle, bid validity, and server targeting will see more sustainable revenue and cleaner ad ops troubleshooting.

Practical takeaway

To use ad unit refresh effectively, treat every refresh as a fresh auction, not a shortcut. Always request new bids and update targeting before sending a refresh command to your ad server—otherwise, you risk stale ads, lower revenue, and challenging debugging sessions.

Start with a single ad unit on a test page to validate your refresh logic. Monitor CPMs and fill rates before rolling out to all infinite scroll or refresh-eligible slots. Make your code modular and responsive to real user interactions for the cleanest, policy-safe results.