Tag Archives: GPT

Google Publisher Tags add official TypeScript type definitions

Today we're happy to announce the release of official TypeScript type definitions for Google Publisher Tags (GPT)!

Why TypeScript?

According to a recent State of JS developer survey, nearly 70% of developers regularly use TypeScript in some capacity, up from 60% the year before. As this segment of the community continues to grow, we are committed to providing the best experience possible for those working with TypeScript and GPT. We believe this is important not just because TypeScript is popular, but because it helps developers validate the correctness of their code and provides a number of quality of life improvements that make working with GPT more delightful.

How we got here

Until now, a number of community-led projects such as @types/doubleclick-gpt and @types/googletag have provided unofficial GPT type definitions. While these projects have done a great job of making our API more accessible to TypeScript developers, manually curated type definitions inevitably lag behind changes made to GPT, leading to those definitions sometimes being out of date. To address this, we've updated our release process to automatically generate type definitions from internal source code and sync changes to our own GitHub repository and the DefinitelyTyped project. This ensures that our official definitions are always up to date with the most recently released versions of GPT.

Try it and let us know what you think

For users new to TypeScript, we've published a TypeScript and Google Publisher Tags guide that covers the basics and provides a demo of the new type definitions in action. For those already familiar who want to try the new definitions right away, they can be installed via NPM by running:

npm install --save-dev @types/google-publisher-tag

If you'd like to make a suggestion, report a bug, or leave any other feedback about this new offering, feel free to open an issue on our GitHub issue tracker.

Take the 2022 Google Publisher Tag developer survey

Since 2020, we've asked the Google Publisher Tag (GPT) developer community to provide their valuable feedback through an annual survey. This feedback influences what we work on each year, and has directly inspired improvements to our sample offerings, release notes, and much more.

As we look forward to next year, it's time once again to check in with our developer community to see what's working well and what can be improved. Starting today, we're kicking off the 2022 GPT developer survey.

Take the survey

The survey should take no more than 10 minutes to complete, and it will be open through the end of October 2022. Most questions are optional and your answers are completely anonymous.

Remember that the feedback you provide influences what we work on over the course of the next year, so please let us know what matters most to you. Thanks in advance for taking the time to help improve the GPT developer experience!

Take the 2021 Google Publisher Tag developer survey

In 2020, we launched the first ever Google Publisher Tag (GPT) developer survey to learn more about our community and understand how we can improve the developer experience. Feedback from users like you directly inspired improvements to our sample offerings, release notes, and much more over the course of the past year.

As we look forward to a new year, it's time once again to check in with our developer community to see what's working well and what can be improved. Starting today, we're kicking off the 2021 GPT developer survey.



The survey should take no more than 10 minutes to complete, and it will be open through the end of October 2021. Most questions are optional and your answers are completely anonymous.

Remember that the feedback you provide influences what we work on over the course of the next year, so please let us know what matters most to you. Thanks in advance for taking the time to help improve the GPT developer experience!

Securing Google Publisher Tags with Content Security Policy

The Google Publisher Tag (GPT) now supports integrating with a Content-Security-Policy (CSP). Using a CSP, you can precisely control which external sources are allowed to load on your site, on a page-by-page basis. In this way, CSPs help to detect and defend against common web vulnerabilities such as cross site scripting (XSS) attacks.

Although CSPs can be implemented in a number of ways, GPT only supports the strict CSP method, using nonces. For detailed instructions on setting this up, see our guide on Integrating with a Content Security Policy.

A note on existing CSPs

While GPT did not previously support CSPs, we're aware that some publishers worked around this by using CSPs based on an allowlist of domains. As previously mentioned, however, only nonce-based strict CSP implementations are supported. This is due to the fact that the set of domains GPT accesses is subject to change over time.

If you've been using GPT with an allowlist-based CSP, we strongly recommend that you supplement or replace it with a nonce-based strict CSP policy. This will reduce the risk that a future change to GPT may break ad serving on your page.

Help improve the Google Publisher Tag developer experience

We’re constantly working to improve our offerings for Google Publisher Tag (GPT) developers. Whether it's writing guides, producing samples, or building tools like the Google Publisher Console and Publisher Ads Audits for Lighthouse, we strive to equip you with everything you need to succeed.

To better understand what's working and what needs improvement, we're asking our developer community for feedback. Starting today, we're launching the first Google Publisher Tag developer survey.

Take the survey


All questions in the survey are optional and your answers will be completely anonymous. We expect the survey to take about 10 minutes to complete, and it will be open through the end of September 2020.

The feedback you provide will directly impact what we work on over the course of the next year, so please let us know what matters most to you. Thanks in advance for taking the time to help improve the GPT developer experience.

Brotli Compression in Google Display Ads

Posted by Michael Burns, Software Engineer, Publisher Tagging & Ads Latency Team

Our goal is to help publishers monetize their content and build sustainable businesses through advertising products that allow sites to load as fast as possible to minimize impact to user experience.

Almost two years ago, our compression team announced a new compression algorithm called Brotli. Today, we are happy to announce that the Brotli compression algorithm is now being used to compress Google Display Ads whenever possible. In our experiments, we see data savings of 15% in aggregate over standard gzip compression, and in some instances, a savings of over 40%! This reduces the amount of data sent to end users by tens of thousands of gigabytes every day! This also results in faster page loads and less battery consumption.

We hope results like this will encourage wider adoption and will advance web standards such as Brotli compression.

Weight Watchers weighs in on their success with Google Publisher Tag and DFP

A top name in weight loss and healthy living for 50 years, Weight Watchers serves over 140 million ad impressions a month at WeightWatchers.com.

Weight Watchers began using the Google Publisher Tag (GPT) in 2012 once they upgraded to the DoubleClick for Publishers (DFP) ad server. They were hoping for better targeting, but they got much more.

Higher ROI, happier advertisers
With up to five levels of targeting hierarchy, GPT let Weight Watchers improve its targeting and end manual re-tagging. The results have been strong with Click Through Rates across all standard display ad units are up 13%, and for leaderboards up 76%. Advertisers are loving the performance and Weight Watchers now runs four times more monthly campaigns with advanced targeting than with basic demographic and geo-targeting.

100% boost in operational efficiency from DFP

"I would actually say we've had a 100% increase in efficiency," says Jordan Tuck of Weight Watchers. Campaign setup is faster, and new features like the ability to update multiple line items on the same page save even more time later.

30% rise in indirect inventory earnings

With the move to DFP, Weight Watchers benefited from Dynamic Allocation with DoubleClick Ad Exchange (AdX) to monetize indirect inventory. Their indirect inventory rates are up 30% year-over-year, and the clickthrough rate is 2.5 times higher than it was before AdX. AdX now has 70% share of their indirectly sold inventory.

Weight Watchers helps its customers "move the needle," and DFP and AdX have helped them do the same with their own online properties.

Read the full Weight Watchers story »

Posted by Yamini Gupta, Product Marketing Team