1 0 6000 0 600 120 30 https://headerbidding.co 960 0

Google Publisher Tag (GPT) – A Beginner’s Guide

Google Publisher Tag
Are you new to Google Publisher Tag (GPT)? Then, here's a primer.

Google Ad Manager (Google DFP) is one of the reliable ad servers for publishers. This article aims to simplify one of its ad tag types ‘Google Publisher Tag‘, which is an overhaul of how usual ad tags work. 

Before explaining what Google Publisher Tag is, let’s get a brief overview of the different types of ad tags available in Google Ad Manager. 

  • Accelerated Mobile Pages – For ads to be displayed on AMP pages.
  • Audience Pixel – For creating first-party user segments and then targeting them
  • Mobile Applications – To serve ads on mobile app inventories.
  • Google Publisher Tag – For building and serving ad requests.
  • Ad Exchange Tag – This will only appear for publishers who have integrated Ad Exchange with Google Ad Manager.

Google Ad Manager allows publishers to generate any of the above-mentioned ad tags for a website. However, the goal of this article to help you to understand Google Publisher Tag. So, let’s start with the basics of it and understand how to set it up step by step.

Table of Contents

What is Google Publisher Tag (GPT)?

Google Publisher Tag is an ad tagging library that helps publishers to build ad requests dynamically. Publishers can get better control creating and serving ads on the inventory through GPT. Not only it enables a publisher to define ad settings in the code itself but also sets targeting options for different ad slots.

In general, a Google Publisher Tag consists of key details such as ad unit size, ad size, and various other key-values to display ads on mobile apps or web pages. A simple GPT looks like as follows: 

GPT Tag Example

In the above GPT sample,

“9876” is the network code, and “sports/football” is the targeted ad unit. If you’re confused about how to find your network code, then go to the Ad Manager home page, and then click Admin > Global settings > Network code. [728,90] is the ad unit size of the targeted slot. 

Line 7 will target the ad slots with key-values “Gender” and “Male”, and line 3 is meant to enable asynchronous rendering. Whereas “div-gpt-ad -90017xxxxxxxx-x” is used by the ad server (DFP) to match the ad slot defined in the header to the ad slot on the web page.

How Google Publisher Tag (GPT) works?

Google Publisher Tag enables a publisher to create a communication path between the Google Ad Manager (DFP) and the user’s browser. This is how Google Publisher Tags work:

  1. A visitor comes to the publisher’s web page. The user’s browser makes a call to the Ad Manager for a  GPT (which consists of a JavaScript code).
  2. This GPT ad tag builds and sends one or more than one ad request to the Ad Manager (DFP) for ads tagged on that particular web page.
  3. With the details provided in the GPT, the ad server recognizes the ad units and key-values associated with it.
  4. Then, it selects the best-matching ad and delivers the ad through the Google publisher tag.
  5. After this, with the help of key-values associated with the GPT helps the ad server to display the ad on the page. 

Now that we’ve understood how GPT works, let’s look at the steps to set-up Google Publisher Tags in the ad server.

How to generate Google Publisher Tag in Ad Manager (DFP)?

Following are the steps to generate GPT in Google Ad Manager (DFP) – 

  1. Sign in to the Google Ad Manager account.
  2. Go to Inventory > Ad units. And, select the ad unit for which you want to create the ad tag.
  3. Click on Generate tags. Then, select the ad tag type as Google Publisher Tag.
  4. And then, click Continue.
  5. Select the appropriate options to define the functioning of Google Publisher Tag (GPT) i.e.
  • Enable single request – This will enable the user’s browser to send one request for all ad units instead of sending multiple requests to individual ad units.
  • Create a passback tag – This can be chosen for setting up multiple demand partners in the waterfall method.
  • Collapse empty divs – On selecting this option, the browser automatically collapses the ad slots that don’t get filled and don’t leave a blank space on the page.
  • Page-level targeting – With this option, you can set custom attributes across all ad slots on the page and utilize page-level targeting.
  • Out-of-page – Use this option to serve pop-up, pop-under, or floating ads through GPT.
  • Inventory unit sizes – Here, you can select the inventory sizes for the ad tag
  • Inventory unit level targeting – This option is used to set custom attributes across the selected ad inventories to target.

6. And, then click continue.

At last, send the generated tag to your developer to paste the tag on the source code of the web page where ads will be displayed.

Benefits of Google Publisher Tags (GPT) Over Google Ad Manager Tags

Configuring Google Ad Manager with GPT could be beneficial to a publisher as it offers: 

  • Asynchronous rendering  – This allows the browser to load an ad without blocking the page rendering and hence, improved page load time.
  • Single request mode – All ad units can be retrieved at once via a single ad request and enables advanced roadblocking. Thus, reduced latency.
  • SSL support – GPT automatically works with HTTPS:// and HTTP://. A publisher doesn’t have to modify GPT for different secured or unsecured pages
  • Multi-level Custom targeting – You can target ads based on slot-level/inventory-level as well as page-level.
  • Google Publisher Console – Via GPT, you can take advantage of Google Publisher Console which consists of its own in-built debugging and support tools for publishers.
  • SafeFrame Capabilities – GPT enables publishers to render ads using SafeFrame which enables transparent interactions between page’s content and ads and prevents any external access to sensitive data. Hence, publishers’ ads render according to IAB standards.

Ad Ops Quick Fix

Troubleshoot Common GPT Errors:

When there is an error in the GPT code, it’s time to do some DFP troubleshooting. So, based on our experience, we’ve put together a couple of common errors and suggestions on how to resolve them.

Error 1 – Mis-ordered calls to Google Publisher Tags. An incorrectly ordered call to GPT can break the code and workflow. For example, if a DFP user sets the page-level key-value targeting after calling the GPT.

GPT Error

Solution – Make sure that key-value targeting is done before calling the GPT. 

Error 2 – Undesirable reflow or unexpected behavior of GPT. A GPT may show unexpected behavior when the user/developer moves or inserts the slot container in the DOM after calling display.


Solution – Ensure that DOM order changes happen before calling display.

Error 3Haphazardly overwriting a GPT. Overwriting any variable or function in GPT may break the code and incorrect behavior.

GPT Function Error

Solution – Always check GPT properties carefully, and never overwrite it.

Error 4 – Relying on the presence of the GPT. If a DFP user checks the availability of GPT API before even it isn’t ready, then it may cause errors. 


Solution – Make sure that the GPT API is ready and the GPT code is completely loaded. 


Google Ad Manager comes with a bundle of features. However, to get the most out of any feature or technology, we suggest you avoid a few common GPT implementation errors that we have discussed in the previous section. If you’re still worried about how to get started with GPT or stuck with some other issues, we’re here to help. Let’s know your doubts/issues in the comments section or get in touch with us.

Automatad Team

At Automatad, we help publishers to monetize better without hampering the user experience. Our products are live across hundreds of publishers, earning them incremental ad revenue with every passing second. You can request a free audit to get an estimated revenue uplift today.

adtech glossary
Previous Post
Adtech Weekly Roundup
Weekly Roundup: VPAI...
Adtech weekly Roundup
Next Post
Weekly Roundup: Cont...
    Leave a Reply