Google Publisher Tag samples

This section contains a collection of examples and related resources for the Google Publisher Tag (GPT) library.

Much of the content in this section can also be found in our GitHub repository. Sample code and associated documentation is released as open source under the Apache License 2.0.

Try building you own custom sample with the GPT sample builder (beta)!

Filter By

Level
Programming language
Keyword

Display a GPT-managed web interstitial ad.

  • TypeScript
  • JavaScript

Use GPT to dynamically generate new ad content.

  • TypeScript
  • JavaScript

Minimize layout shift by reserving space for ads.

  • JavaScript
  • TypeScript

Display a GPT-managed rewarded ad.

  • TypeScript
  • JavaScript

Display a GPT-managed anchor ad.

  • TypeScript
  • JavaScript

Precisely control which ad slots are requested when in Single Request Architecture (SRA) mode.

  • JavaScript
  • TypeScript