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

Specify which ad sizes are eligible to serve to an ad slot.

  • JavaScript
  • TypeScript

Display a fixed-sized test ad.

  • JavaScript
  • TypeScript

Display a GPT-managed gaming interstitial ad.

  • TypeScript
  • HTML
  • JavaScript

Display a GPT-managed rewarded ad.

  • JavaScript
  • TypeScript

Automatically show/hide ad slots when certain criteria are met.

  • TypeScript
  • JavaScript