There are a number of ways to integrate GPT into your site, and some key decisions to make. For example, you must choose whether or not to use responsive design to manage the sizes of your ad slots.
To help you avoid some of the common implementation mistakes and make the most of GPT, view the common GPT implementation mistakes and fixes developer documentation.
The developer documentation contains details of how these mistakes can be addressed. When developing for GPT, it is recommended that you familiarize yourself with these common mistakes and their remedies.
We do not recommend directly manipulating the GPT API (including any GPT rendered elements) beyond what is exposed explicitly in our GPT API documentation, as Google cannot guarantee the behavior.
Common implementation mistakes
Review the following common implementation mistakes described in the GPT developer documentation:
- Relying on
gpt.js
script tag listeners - Checking the
googletag
object to know whether GPT is ready - Relying on obfuscated code syntax
- Overwriting any function or variable of GPT
- Mis-ordering calls to GPT
- Misusing closures and JavaScript variable scoping
- Serving
gpt.js
,pubads_impl.js
, or libraries they load from your own servers, or an unofficial source.