Integrating Google, Prebid & Amazon APS

A practical guide showing how to run prebid.js and apstag.js in parallel, synchronize targeting, and fire gpt.js

Idea

This project demonstrates how to integrate Google GPT.js, Prebid.js, and Amazon APS (apstag) together in a unified header bidding setup. It initializes all three libraries in sequence, manages async bid responses, and syncs targeting to GPT for ad rendering — providing a clean, production-ready example of multi-source ad monetization with full debugging support.

Recommended pattern

  1. Define GPT slots early (so the DOM and GPT slot objects exist).
  2. Start Prebid and apstag auctions in parallel.
  3. Wait for both to finish (or for a timeout).
  4. Apply Prebid and apstag targeting to GPT.
  5. Call googletag.display() (first render) or googletag.pubads().refresh() for subsequent refreshes.

Sample implementation