Skip to main content
Knowledge Base

The Secret Weapon for Responsive Ads: Unveiling Google Ad Manager’s Size Mapping

By April 15, 2024No Comments
The Secret Weapon for Responsive Ads: Unveiling Google Ad Manager Size Mapping

Objective:  This article demonstrates the use of the ‘sizeMapping()’ function provided by Google Ad Manager (formerly DoubleClick for Publishers). The primary objective of the sizeMapping() function is to achieve optimal ad delivery within a web page which helps with the following:

  • Enhance User Experience: By mapping appropriate ad sizes to different viewport dimensions, size mapping prevents poorly-sized ads that stretch, overlap content, or disrupt the layout. This creates a more visually pleasing and user-friendly experience for website visitors.
  • Maximize Revenue Potential: Delivering well-sized and relevant ads can lead to higher click-through rates (CTRs). Users are more likely to engage with ads that are displayed correctly and don’t detract from the content. This translates to potentially increased ad revenue for publishers.

How size mapping works: There are a few different parameters present in the size mapping function as described below:

  • googletag.sizeMapping(): This function creates a size mapping object used to define ad size variations for different screen sizes.
  • addSize([width, height], [[ad_width, ad_height]]): This method within the size mapping object defines a mapping rule. Here, it specifies:
  • build(): This final method finalizes the size mapping object and makes it ready for use.

Lets understand this with an example: 

googletag.defineSlot(‘/path/to/ad/unit‘, [[728, 90], [300, 600], [300, 250]], ‘div-id‘).addService(googletag.pubads());

// Size mapping for different viewports

var mapping = googletag.sizeMapping();

mapping.addSize([1200, 0], [[728, 90]]);  // Large desktops (>= 1200px wide)

mapping.addSize([980, 0], [[300, 600]]);  // Standard desktops (980px – 1199px wide)

mapping.addSize([0, 0], [[300, 250]]);  // Mobile & Tablets (default);

// Apply size mapping to the ad slot

googletag.display(‘/path/to/ad/unit‘, mapping);

googletag.defineSlot(‘/path/to/ad/unit‘, [[728, 90], [300, 600]], ‘div-id’).addService(googletag.pubads());

Here we have created a sizeMapping object using googletag.sizeMapping(). And three addSize methods define the mapping rules:

  • The first rule targets viewports wider than or equal to 1200px and requests a 728×90 ad size.
  • The second rule targets viewports between 980px and 1199px wide and requests a 300×600 ad size.
  • The third rule acts as a catch-all which targets viewports between 0px and 979px wide and requests a 300×250 ad size.
  • Finally, the build method finalizes the size mapping and the display method associates the mapping with the ad slot.

Benefits of Size Mapping:

  • Improved User Experience: By delivering ads that fit the available space, size mapping prevents ad stretching or overlapping content, leading to a more visually appealing and user-friendly experience.
  • Increased Revenue Potential: Utilizing appropriate ad sizes can lead to higher click-through rates (CTRs) as users are more likely to engage with ads that are well-displayed.
  • Flexibility: Size mapping allows for defining multiple ad size options, catering to various screen sizes and responsive layouts.

In short, the sizeMapping() function is a valuable tool for publishers using Google Ad Manager to deliver optimal ad experiences and potentially maximize their ad revenue.

How can DataBeat help? 

Optimizing ad delivery with effective size mapping strategies can be complex. Databeat’s experienced AdOps team offers comprehensive assistance in this area. From strategic planning to implementation expertise, we help define optimal ad sizes for your target audience and website layout. By leveraging Databeat’s AdOps expertise, you can ensure that your website delivers a seamless user experience while maximizing your ad revenue potential through effective size mapping techniques.

Book a Meeting

Leave a Reply