Overview of Google Publisher Tags

What is the Google Publisher Tag (GPT)?

GPT is an ad tagging library with which you can dynamically build ad requests. GPT takes key details from you such as ad unit code, ad size, and custom targeting, builds the request, and displays the ad on web pages or mobile apps (learn more about tagging for mobile sites and applications). You can define shared settings such as targeting at a page level instead of defining the same targeting for individual ads on the page. You can also control how and when ad requests are made. For example, you can render ads asynchronously so that they don't block other elements on the page and you can use single-request architecture to call all ads once in the header of your page.

Benefits of using GPT

There are multiple benefits of using these tags:

  • Five-level inventory hierarchy: The Google Publisher Tag allows you to use more granular levels of inventory in the DFP front-end. With five levels of hierarchy, you'll be able to create much more specific targeting based on your site content. Learn more
  • Faster page loads: An asynchronous JavaScript fetch means that instead of waiting for the JavaScript to be returned from the DoubleClick servers, the page continues rendering and loads the ads into iframes when the creatives are returned from the server. Learn more
  • Google Publisher Console: The tag comes with a built-in debugging and support tool called the Google Publisher Console, which is enabled on all pages containing the Google Publisher Tag. Learn more
  • Single request mode: Instead of sending individual ad requests to DoubleClick servers, the browser is able to send one request notifying the server of all ad units on the page. This enables advanced roadblocking and improves page load time. Learn more
  • Automated setup for interstitials: DFP lets you specify that your tags are for an out-of-page unit and automatically adds the additional code. There's no need to add code manually. Learn more
  • SafeFrame capability: SafeFrame technology enables transparent and rich interactions between page content and ads, while providing publisher control and preventing external access to sensitive data. Learn more
  • Support responsive design: You can use GPT to build responsive ads that fit the browser your visitors use to view your website. This means that your ads will look good whether your visitors are using a desktop, tablet, or smartphone. Learn more
  • Automatic cache-busting: When GPT assembles ad requests corresponding to a page view, it automatically includes a "correlator" value, eliminating the need to manually insert a cache-busting value in the tag.* Learn more
    * You do still have the option to update the correlator value if you need to simulate a new page view. Learn more

How GPT works

The Google Publisher Tag is used to define available ad slots in your network. Placing a tag on a page creates a communication path between the ad server and a user’s browser. When a page containing a Google Publisher Tag is rendered, the following sequence of events occurs:

  1. A request is made from the user's browser to the ad server for gpt.js, the tagging JavaScript.

  2. The tagging JavaScript builds and sends one or more requests (depending on whether single-request mode is enabled) to the ad server for ads tagged on the page.

  3. The ad server recognizes the ad units and any custom targeting contained within the request.

  4. The ad server selects and returns the best matching ad.

  5. The JavaScript code associated with the ad tag displays the ad on the page.

GPT and secure pages (https://)

GPT works automatically with secure webpages whose URLs begin with https://. There's no need to modify the tag in any way for serving on a secure page.

HTTPS stands for HyperText Transfer Protocol Secure. It's a communications protocol that's built on top of the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. These protocols encrypt certain elements of the communication between the server and the client in order to prevent tampering and eavesdropping by third parties.