Google GPT: A Complete Beginner’s Guide

Google publisher tag blog cover photo

Historically, to set up ad tags, which are just snippets of code that contain information about the ad creatives, publishers would need to enlist the assistance of an AdOps team. However, with Google GPT (Google Publisher Tag), building and serving ad requests became fast and straightforward for publishers using Google Ad Manager and Google AdSense

Today, we will introduce you to the Google GPT, explain how it works, and how you can get started with it today! 

Table of Contents:

What is Google GPT?

Google Publisher Tag (GPT) is an ad tagging library for Google Ad Manager designed to dynamically build ad requests for publishers. With GPT, publishers can easily define their ad inventory, initiate ad requests, render matching demand, and display the ad on a publisher’s webpage. 

What is a GPT tag?

GPT tag is essentially a property that defines how the ads will be displayed on the page, which in this case is using Google Publisher Tag. For every ad on your web page, a GPT tag tells the ad servers what ad size, ad unit, and targeting it requires. These tags improve page loading time and overall interaction of the ads with the site’s code. 

Here’s a sample GPT tag for a banner ad. As you can see, to implement a GPT tag, you must insert it between the <head> </head> element of the HTML source code. In addition, you will also need to implement a GPT body tag between the <body> </body> section on the HTML source code, which will define where the ad placement will show on your page.

google publisher tag sample banner ad tag

How Google GPT works?

Google Publisher Tag helps to define ad slots available for tagging. GPT enables the ad server (Google Ad Manager) and the user’s browser to communicate. This is how it works:

  1. When a user visits the publisher’s site, an ad request is made from the user’s browser to the ad server (Google Ad Manager) for a GPT JavaScript (JS) tag code.
  2. GPT ad tag builds and forwards ad requests to the ad server. 
  3. The ad server matches the ad requests to relevant key-value pairs like ad unit size, targeting criteria, etc.
  4. The ad server performs an auction to select the most relevant ad creative for that ad unit. 
  5. Once a match is found, the ad server delivers the ad to GPT JS.
  6. The GPT JS begins rendering the ad, and the ad gets displayed on the publishers’ webpage.

Benefits of Google GPT

  • Custom targeting

GPT allows publishers to create more specific targeting criteria according to their site’s content and define targeting settings for the whole page and individual ad slots.

With GPT, asynchronous JavaScript fetch doesn’t block the page content from loading because the ads and the content load concurrently (independently). 

  • Google Publisher Console

GPT comes with a pre-built tool called Google Publisher Console, which is used for troubleshooting and debugging all pages where ads are displayed through the GPT. 

  • Responsive design

With GPT API, you can specify multiple sizes for the same ad slot (e.g., for smaller or bigger browsers), as well as for mobile, laptop, and desktop devices.

  • Single request architecture (SRA)

With SRA, there is only one ad request, which fetches all creatives for defined ad units on the page. As a result, the page’s loading speed improves. You can set up SRA using googletag.pubads().enableSingleRequest(); in your GPT code. This mode is also recommended and supports all GAM creative types except for Studio Dynamic ads.

  • SafeFrame

SafeFrame is a GPT capability that allows safe and rich interactions between the ads and the webpage content. It also acts as a firewall from malicious ads and auto-redirects. SafeFrame supports all creative types except AMPHTML ads.

  • Secure connection

GPT automatically serves ads on secure websites (URLs begin with https://). Remember, HTTPS connection is a best practice on the web, so get one first if you don’t have it already. 

How to Get Started with Google GPT in Google Ad Manager?

First of all, to get started with Google GPT, you need to have an active Google Ad Manager account. Then to generate GPT tags, just follow these steps: 

1. Sign in to your Google Ad Manager account.

Google Ad Manager Sign In Page

2. Go to Inventory →  Ad units and choose the ad unit you want to generate the ad tag for. 

google ad manager inventory ad units selection

3. Now select Google Publisher Tag as your tag type option and click Continue

google ad manager google publisher tag selection

4. Next, set the options of your GPT tag. Once done with this step, click Continue.

  • Passback tag ensures an ad request sent to a third party will be filled by an ad in your Google Ad Manager (GAM) network.
  • Single request will make the user’s browser send one ad request for all ad units instead of multiple ones.
  • Empty divs will automatically collapse the ad slots that didn’t get filled.
  • Page level key-values allow setting custom targeting attributes across all available ad slots on the publisher’s page.
  • Out-of-page creative allows publishers to serve rich media ad formats which appear outside of the page, such as pop-up, pop-under, and floating ads. 
  • Live traffic is an option for video and audio tags served through VAST. This option will only be available if you have a dedicated Google account manager.
  • Sizes set the size of the ad tag.
  • Ad slot key-values allow setting custom targeting attributes for individual ad slots.
google ad manager tag options menu

5.1. Your Tag results will come up. If you didn’t create a passback tag, copy the Document header and Document body tags and paste it between the <head></head> and <body></body> sections of your HTML document. 

google ad manager tag results header body

5.2. Alternatively, if you created a passback tag, simply copy the Document body tag and paste it between the <body></body> section of your HTML documents.

google ad manager tag results body

Conclusion

Overall, Google GPT is one of the most easy-to-use ad tagging libraries that publishers can use themselves. Google Ad Manager has tons of documentation, sample source codes, and useful tools that help test the ads and spot errors right away. 

As always, if you have any questions regarding Google GPT or how to set up GPT tags, feel free to use the comment section below or contact us at [email protected]

Join the conversation