How to integrate A9 alongside prebid in Google Ad Manager (GAM)

How to integrate A9 alongside prebid in Google Ad Manager (GAM)

Amazon has been a household name in online retail for years. Since launching their advertising solutions via their A9 subsidiary, they have been able to make tremendous inroads into the existing market. They collect a vast amount of data on their customers, which enables end-users to be targeted by specific ads based on activity. As a result, this gives the potential of much higher clickthrough rates and revenues.

Amazon’s offerings in the header bidding market, the Transparent Ad Marketplace (TAM), and the Unified Ad Marketplace (UAM) are vital for publishers. TAM is aimed at larger publishers and allows them to add their demand sources, while the UAM is more of a ‘plug-and-play’ solution that offers a more straightforward setup and access to Amazon’s existing partnerships.

For those customers already running Prebid (or MonetizeMore’s PubGuru header bidding technology), the question is whether it’s worthwhile to add Amazon’s product alongside. Let’s consider complexity, cost of integration, and potential results.

Advantages and disadvantages

The main benefit comes from the potential quality of the demand source. It’s Amazon we’re talking about, so their ads are very well targeted to users and come from excellent sources. You’ll have more bids competing for your impressions, which means higher revenue. On the flip side, more demand sources can always add complexity and latency to your page loads. You’ll need to manage this carefully to ensure that user experience does not suffer. In even small businesses, comprehensive documentation should be produced to ensure the implementation gets handled smoothly.

Implementing; sequential or parallel?

There are two methods to integrate Amazon Publisher Services (APS) tags alongside Prebid. These center around the sequencing of when to call the two demand sources. With the sequential method, either Prebid or APS is called first, and then the other is called, whereas, with parallel, they are both called simultaneously.

Initiating calls sequentially is less complicated to adopt. In this case, we would call APS immediately after Prebid to give both sets of bidders as much time as possible to return bids. Your call to GAM to refresh ads must be moved after the call to both bidders (or APS’s bidders would not be able to be displayed).

The more efficient, but complicated solution is to call the two groups of bidders simultaneously, or in parallel. The call to GAM to refresh the ad slots will take place when they have both returned a winning bid (unless one of them times out).

Amazon themselves recommend the parallel method if you can implement JavaScript to do so. We anticipate that most publishers should be able to accomplish a parallel integration.


As stated previously, the two calls to the bidders (Amazon’s apstag.fetchBids() and Prebid’s pbjs.requestBids()) must be made as close together as possible. With just Prebid on your site, the Prebid integration includes the command to GAM to refresh ads (googletag.pubads().refresh()). This must be removed/commented out before placing the APS implementation directly underneath and allowing APS to make this call to GAM. In this example, the APS script is placed directly below the Prebid script; when APS has returned its bids, APS will initiate the call to GAM with googletag.pubads().refresh().

The issue here is that even though you have given both APS and Prebid as much time as possible to complete their bidding processes, APS may still trigger the call to refresh ads before Prebid has returned their winning bid. As a result, Prebid could miss out on the auction (or vice versa, if you’ve implemented APS before Prebid). This is why Amazon recommends parallel integration.


With parallel integration, the call to GAM happens when both Prebid and APS have returned their bids. The exception here is unless one fails to return any bids before the timeout has been hit. This is vital to ensure that A9 is not left hanging when Prebid has an issue returning a bidder or vice versa.

Amazon has created a request manager function to help integrate APS in parallel with Prebid. The executeParallelAuctionAlongsidePrebid() function manages all three main calls; the request to APS for bids, the request to Prebid for bids, and the call to GAM to display. With this, you can keep your Prebid code as is but move the pbjs.requestBids() code block into the requestHeaderBids() function. You would then remove the pbjs.sendAdserverRequest() code block, as that request would now be made inside the  executeParallelAuctionAlongsidePrebid() function. Make sure all these changes are well-documented as you complete them to enable yourself or any future developers to understand the changes that were made and to reverse them if necessary in the future.


If you’re already using the PubGuru Header Bidding, we can help you with implementing APS’s request manager function. Alternatively, we can assist you with a custom function that will enable you to integrate APS alongside our product using the more efficient parallel method. This will ensure that you maximize your site’s revenue. Sign up to MonetizeMore to get started today!

Get my ad optimization tips and tactics delivered to your mailbox.

Kean Graham

CEO and Founder at MonetizeMore

Kean is the resident expert in Ad Optimization covering areas like Adsense Optimization, DFP Management, and third-party ad network partnerships. Kean believes in the supremacy of direct publisher deals and holistic optimization as keys to effective and consistent ad revenue increases.

Submit a Comment

Your email address will not be published. Required fields are marked *