Google Publisher Tag (GPT) stores a record of each ad currently rendered on the page. This is known as a client-side token.
This token automatically allows you to correlate requests from all ad slots on a page for an indefinitely long time period. This behavior can improve monetization on pages with dynamic content where requests may be separated by long intervals, such as infinite scroll pages, pages with lazy loading, Single-Page Applications (SPA), and Progressive Web Applications (PWA).
Client-side tokens are used to help select creatives that will serve to other ad slots on the page, including the following cases:
- Selecting multiple creatives from one set for roadblocking
- Excluding individual creatives based on competitive exclusions
- Preventing duplicate ads from serving to one page
Best practices
The client-side token feature is enabled for all publishers. Most publishers won't need to make any changes to benefit from this token, but we recommend some best practices for API calls and structuring your page.
Send SRA requests with all ad slots
In order to receive the expected ad serving behavior with the best possible performance, use Single request architecture (SRA) to send a request containing all ad slots you want decided on together.
If generating SRA requests is not possible, you can fully serialize your requests to ensure the expected behavior. Each request must wait on the SlotResponseReceived
event from the previous request. However, this is sub-optimal for latency and serialization should only be used if absolutely necessary.
Use destroySlots()
to remove ad slots
When removing an ad slot from a page, always use the destroySlots()
API call to dismantle the slot and remove all related objects and references from the page.
Once the client-side token expires, the ad slot will stop impacting creative selection decisions for the ad server.
The client-side token resets when destroySlots()
is used to remove existing slots from the page. The token also resets when using the page navigation.
Token expiration
A GPT client-side token automatically expires after 10 seconds. If you previously relied on the client-side token expiring after 30 seconds, you may want to restructure your page or ad serving configuration.