This article describes Google Publisher Tag (GPT) client-side tokens, including how they're used to optimize ad serving and the best practices to use them effectively, especially when serving ads to dynamic content.
What are client-side tokens?
In the content of GPT, client-side tokens are records stored in a user's browser that allow for the correlation of ad requests on a page, aiding in optimized ad selection and delivery. Client-side tokens help ensure a more cohesive and efficient ad serving experience.
How are client-side tokens used with GPT?
Here are some examples of how client-side tokens are used to help ensure a more cohesive and efficient ad serving experience with GPT:
- Track ad rendering: GPT creates a client-side token, a record of rendered ads on a page, which helps correlate ad requests from various ad slots on the page.
- Benefits for dynamic content: It improves monetization on pages with dynamic content, such as pages with infinite content or lazy loading where ad requests might be spread out.
- Creative selection: The token assists in selecting creatives for other ad slots, which is useful for roadblocks (multiple creatives from one set), competitive exclusions (preventing competitors' ads), and for preventing duplicate ads.
Best practices to take advantage of client-side tokens
Use single request architecture (SRA) 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 together.
SlotResponseReceived
event from the previous request. However, this is not optimal for latency and serialization and 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 stops 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.
Be aware of token expiration
A GPT client-side token automatically expires after 10 seconds. You should structure your page and ad serving configuration to accommodate this timing limit.