How to Design GAM Inventory Structure to Suit Prebid Needs
Optimizing your Google Ad Manager (GAM) inventory structure to align with Prebid requirements is crucial for enhancing header bidding efficiency and maximizing ad revenue. This comprehensive guide covers essential aspects such as size mapping, ad unit structures versus key-values, and tag setup suggestions.
Understanding Prebid and GAM Integration
Prebid.js is a widely used open-source header bidding wrapper that allows publishers to implement programmatic advertising efficiently. However, to achieve optimal performance, it’s crucial to structure the GAM inventory in a way that complements Prebid’s functionalities.
1. Size Mapping
What is Size Mapping?
Size mapping is a feature that enables responsive ad delivery by allowing publishers to specify which banner sizes should be displayed based on different viewport dimensions. This functionality streamlines ad unit management by consolidating multiple size configurations into a single ad unit rather than requiring separate units for each screen size.
Publishers can use size mapping to:
- Show different ad sizes based on screen/browser width and height.
While both Google Ad Manager (GAM) and Prebid support size mapping, they implement it differently and require separate configurations. GAM implements size mapping directly through GPT tags, whereas Prebid requires the Advanced Size Mapping module. Although these can be used independently, it’s recommended to implement size mapping consistently across both systems for optimal performance and management.
This approach simplifies ad inventory management by reducing the number of distinct ad units needed while maintaining granular control over ad display across different device types and screen sizes.
Advanced Size Mapping in Prebid.js
The Advanced Size Mapping module in Prebid.js provides enhanced control over ad unit behavior based on viewport size and other conditions, offering more flexibility than the core sizeConfig
feature. It allows publishers to configure banner, video, and native ads individually and determine which bidders should participate based on viewport breakpoints. Unlike global sizeConfig
, this module enables AdUnit-level targeting with distinct size buckets and bidder configurations. It’s ideal for complex site designs where ad behavior varies at different screen widths.
Note: media queries are not used in the AdUnit-level sizeConfig
objects in Prebid.js. Instead, size buckets are defined using the minViewPort
property, which specifies the minimum viewport size required for an ad size to activate. Each AdUnit and Bidder can have its own size buckets, enabling a more granular and flexible configuration tailored to complex site designs.
It introduces conditional size mapping, allowing for precise control over ad delivery by leveraging complex media queries and additional factors such as screen orientation, pixel density, and browser type.
Key Components
- AdUnit-Level Size Configuration
Unlike the global sizeConfig
, it allows configuration at the AdUnit and Bidder level, enabling distinct ad behavior for each unit. Publishers can specify different size rules for individual AdUnits, making it easier to optimize ad performance for complex layouts.
- Size Buckets Using
minViewPort
Instead of media queries, the module utilizes minViewPort
to define the minimum width and height required to activate a given set of ad sizes. For example, if minViewPort
is [750, 0], this size bucket will activate only when viewport width is greater than 750.
- Multi-Format Support:
The module supports three media types: banner, video, and native, and allows setting unique rules for each.
- Conditional Rendering with Labels
Labels aren’t defined AdUnit sizeConfig
object. Labels help activate or deactivate AdUnits and bidders based on conditions such as geography.
- Optimization for Complex Layouts
Designed for publishers with intricate site designs that require different AdUnits or media types to respond uniquely to varying screen sizes. For example, a left-navigation ad may resize at 600px, while a footer ad might change at 800px.
- Implementation Efficiency:
The module simplifies the management of complex size mappings with a structured JSON configuration.
- Performance Considerations
Including the module adds approximately 12KB to the Prebid.js build size, so it is recommended for publishers with complex site designs.
Adding Prebid Advanced Size Mapping Module in Setupad Self-Serve Prebid Panel
Important to note:
* Works only from Prebid version 9.9.0
* Size mapping ignores sizes added in the Prebid Panel under creative settings.
1. The Prebid Size mapping module uses JSON format.
The viewports and sizes have to match with what is defined in GPT tags. Here is a sample code that is applied in the Size Mapping module:
2. Minify the JSON code by using JSONMinifier.
It should look like this:
3. JSON code needs to be added in the Size mapping attribute as shown in the picture below:
Once added, you should be able to see the mapping in Professor Prebid under “Media Types”:
Further Readings:
Read more about Prebid Size Mapping.
2. Key-Values Structure vs. Ad Unit Hierarchy
When integrating Prebid with Google Ad Manager (GAM), adopting a key-values strategy is generally more advantageous than extensive ad unit hierarchy. This approach offers enhanced flexibility, scalability, and efficiency in managing ad inventory and targeting. Moreover, publishers can achieve a more adaptable and efficient integration of Prebid with Google Ad Manager, leading to improved ad performance and revenue outcomes.
Key-values in Prebid facilitate bid-level targeting by transmitting details such as the winning bidder, bid price, and other metadata.
1. Key-Values Approach
Key-values in GAM allow publishers to define custom targeting parameters that can be dynamically included in ad requests. By assigning specific keys and corresponding values to ad requests, you can target ads based on various criteria such as user demographics, content type, or ad positions.
This method is particularly beneficial for Prebid integrations due to the following reasons:
- Dynamic Targeting
Key-values enable real-time targeting based on various parameters such as user demographics, content type, or device characteristics. For instance, you can set keys like hb_pb
(header bidding bid price bucket) and hb_bidder
(the bidder code) to pass bid information to GAM. The targeting is precise and enhances ad relevance.
Source: Prebid
- Simplified Inventory Management
Instead of creating a complex ad unit hierarchy to represent every possible targeting scenario, key-values allow for a more streamlined setup. This reduces administrative overhead and simplifies the process of managing and updating inventory.
- Enhanced Reporting and Optimization
By utilizing key-values, publishers can gain deeper insights into ad performance across different segments. This granularity aids in optimizing ad delivery and maximizing revenue. However, ongoing management is still necessary to keep key-values relevant and effective.
2. Ad Unit Hierarchy Approach
An ad unit hierarchy organizes your ad inventory into a parent-child structure, reflecting the layout and sections of your website or app. This hierarchical arrangement allows for inherited attributes, where child ad units can inherit settings from their parent ad units, simplifying management and ensuring consistency across similar sections.
For instance, if you have a “Sports” section with subsections like “Football” and “Basketball,” you can set up a parent ad unit for “Sports” and child ad units for each subsection. This setup enables targeted ad delivery to specific content areas.
While organizing inventory through a detailed ad unit hierarchy can provide a clear structure, it has limitations, especially in the context of Prebid:
- Rigidity: A static hierarchy may not accommodate the dynamic nature of header bidding, where demand partners and targeting criteria can frequently change.
- Maintenance Complexity: Managing a vast number of ad units to cover all targeting combinations can be labor-intensive and prone to errors, especially as your site grows.
3. Hybrid Approach
Combining both ad unit hierarchies and key-values can offer a balanced solution, leveraging the structural clarity of hierarchies and the targeting precision of key-values.
For example, you can use an ad unit hierarchy to define broad sections of your site and apply key-values for more specific targeting within those sections, such as distinguishing between different ad positions or user demographics. This approach provides flexibility and scalability, accommodating complex targeting needs without overcomplicating the ad unit structure.
Many publishers find that a hybrid strategy offers the best of both worlds:
- Structural Organization: Maintain a basic ad unit structure to represent primary sections or formats of your inventory.
- Flexible Targeting: Use key-values to define more granular targeting within these primary ad units, allowing for dynamic adjustments without restructuring the entire hierarchy.
Further Readings:
Read more about Prebid integration with GAM (including the use of key-values).
Read our step-by-step guide for implementing Prebid with GAM.
3. Head-Body vs. Wrapper-Body Tag Setup in Prebid.js
The placement and structure of Prebid.js tags within your website’s HTML can significantly impact the efficiency of header bidding. Proper tag setup ensures that the bidding process completes on time, preventing latency issues and maximizing revenue opportunities. Two primary implementation strategies exist: Head-Body Setup and Wrapper-Body Setup, each with its own benefits and considerations.
1. Head-Body Tag Setup
In this approach, the Prebid.js library and auction configuration are placed within the <head> section of the page. This allows the header bidding process to initiate early during page load, ensuring that bid responses are available when the ad request is made to Google Ad Manager (GAM).
The Head-Body Tag is divided into two parts:
- Head Part: Defines the ad units and settings, placed within the
<head></head>
section of your HTML document. - Body Part: Specifies where the ads should be displayed and placed within the
<body></body>
section of your HTML document.
Advantages
- Reduced Latency: Head-body tags make a single call to the ad server, therefore reducing the latency. By using Single Request Architecture (SRA), instead of requesting ads slot-by-slot (which could introduce delays), all ad slots on the page are bundled into one single call to GAM, further reducing latency.
- Higher Bid Completion Rates: More bids are available by the time GAM makes an ad request, leading to better competition and potentially higher CPMs.
- Improved Viewability: Faster loading ads contribute to higher viewability scores, which can attract premium advertisers.
Challenges
- Render-Blocking Risk: If not implemented asynchronously, it may delay other critical page elements such as stylesheets and scripts.
- Page Speed Impact: Adding too many scripts in the head section can slow down perceived page performance, potentially affecting user experience.
Best Practices for Head-Body Setup
- Load Prebid.js asynchronously to prevent it from blocking critical page rendering elements.
- Set timeout values appropriately to balance bid completion with page speed.
- Utilize lazy loading strategies to further optimize ad performance without compromising core web vitals.
Head-Body Tag Example
2. Wrapper-Body Tag Setup
With this approach, the Prebid.js wrapper is included within the <body></body>
section of the page, often before or around the ad tag placements. This method provides more granular control over each ad unit and helps organize demand sources efficiently while reducing potential page load delays.
Advantages
- Non-blocking Execution: The bidding process does not interfere with the initial loading of core website elements and is often used to prioritize user experience by delaying ad loading until necessary (e.g., through lazy loading).
- Easier Integration: Simplifies troubleshooting and tracking ad-related scripts without impacting the critical rendering path.
- Flexible Demand Management: Allows demand sources to be loaded only when needed, optimizing ad delivery in real-time.
Challenges
- Unfilled Requests: If you’re using a head-body setup and some ad units are only present on specific pages, there will be instances where the head code loads, but the corresponding body code does not (as it isn’t included on those pages). This can lead to unfulfilled requests to Google Ad Manager (GAM), resulting in lower viewability and unnecessary costs. To prevent this, it’s recommended to combine a wrapper-body tag setup with the head-body approach for better ad delivery efficiency.
- Potential Timing Issues: If the wrapper executes too late in the page load process, ad requests might be delayed, resulting in missed bids or lower competition.
- Viewability Concerns: Delays in rendering may negatively affect ad viewability metrics.
Best Practices for Wrapper-Body Setup
- Ensure the wrapper script is positioned as high as possible in the
<body></body>
section to avoid delays in execution. - Use lazy loading triggers to load the wrapper when users scroll to the ad placement.
- Implement bid caching to store bid responses and serve ads quickly.
Example Implementation:
When to Use Each Setup?
Head-Body Setup | Wrapper-Body Setup |
You prefer a straightforward integration directly into your website’s code. | You need individual control over each ad unit’s settings, such as timeouts and refresh rates. |
Your website has a consistent layout across all pages. | Your website has diverse and varying layouts across its pages. |
You want to reduce ad loading times. | You want to conduct A/B tests to optimize ad performance. |
You need precise ad targeting for different screen sizes. | You need flexibility in integrating ad units with other ad servers. |
Best Practices for Optimizing Tag Setup in Prebid.js
Conclusion and Recommendations
To optimize your Google Ad Manager (GAM) setup for Prebid integration, it’s essential to strike a balance between flexibility, efficiency, and maintainability. Based on the insights provided, the following recommendations can help achieve optimal ad performance:
- Use Key-Values for Specific Section Targeting
Implement key-values to dynamically target ads based on site sections, user demographics, or content types without the need for complex ad unit hierarchies.
- Leverage Size Mapping
Configure Prebid’s advanced size mapping to target multiple screen width/heights with different sizes, ensuring a better user experience and increased ad fill rates.
- Implement a Hybrid Structure
Combine a minimal ad unit hierarchy with key-values to maintain a structured inventory while allowing granular, real-time targeting without overcomplicating management.
- Enable Single Request Architecture (SRA)
Use googletag.pubads().enableSingleRequest()
; to consolidate ad requests into a single call, reducing latency and improving page speed.
- Optimize Ad Tag Placement
Consider a combination of head-body and wrapper-body setups to prevent unnecessary ad calls and improve viewability metrics, ensuring that ads are only requested when they are present on the page.
By implementing these strategies, publishers can maximize revenue potential, improve user experience, and ensure efficient ad operations while maintaining scalability and flexibility in their ad stack.