- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog Blog
- Support Desk Support Desk
The GPT, primarily an Ad Tag. allows you to define ad slots and the criteria or audience you'd like to target through the ad. You may enable this Tag to display a single ad or multiple ads by suitably configuring the Tag.
This Tag is available in Tealium's Tag Marketplace, which is home to a large selection of vendor Tags. Click here to learn how to add a Tag to your Tealium iQ profile.
Here's how to set up an instance of this Tag for a single ad slot.
"<em>Example </em>:" /1234/travel/asia/food
NC = 1234 and Targeted Ad Unit = /travel/asia/food
Example:"div-gpt-ad-123456789-0"
NOTE: You have the option to configure these settings from the Mapping Toolbox.
Load Rules determine when and where to load an instance of this Tag on your site. The 'Load on All Pages' rule is the default Load Rule. To load this Tag on a specific page, create relevant Rule conditions to apply to the Tag.
Best Practice: Load this Tag on any page that contains the target ad slot.
Here's a sample Load Rule that loads the Tag if the pathname contains "/food".
Mapping is the simple process of sending data from a data source, in your Data Layer, to the matching destination variable of the vendor Tag. The destination variables for this Tag are available in the Data Mapping toolbox.
For instructions on how to map to a Tag destination, see Mapping Data Sources.
Destination Name | Destination Variable | Description |
---|---|---|
Network Code | networkcode | This code is available in the Admin tab of your DFP account |
Targeted Ad Unit | adunit | This is the target Ad Unit |
Height | height | Height of the ad slot |
Width | weight | Width of the ad slot |
Set Slot-level Targeting | setTargeting_slot | Sets the "key:value" parameters for the target ad slot Example: .setTargeting("interests", "sports"); |
Set Page-level targeting | myvar | Sets the "key:value" parameters of all ad slots on a page NOTE: Replace "myvar" with your custom targeting parameter name. Example: googletag.pubads().setTargeting("topic","sports"); |
Multiple Slot Configs | gptSlots | Define an array of slots for a single page (more details below) NOTE: Make sure the data source being mapped from contains an array |
Collapse Empty DIVs | collapseEmptyDivs | Collapses ad slots that do not get filled NOTE: Make sure the data source value contains either "true" or "false" |
Adding and configuring the GPT for a single ad slot is very simple and straightforward. Employing the same process to configure multiple ad slots becomes tedious as you would have to to add an instance of GPT for all the ads you wish to display. The quick alternative is to store all slot configurations in an array then map the array to the 'Multiple Slot Configs' destination in the GPT instance. To create such an array, you can use the JavaScript Code Extension. Make sure to define the slot configs for every ad in this order:
[[Network Code + Targeted Ad Unit, Eligible Creative Size(s), Ad Container DIV ID, Slot-Level Targeting Name/Value Pairs]]
Write a JavaScript code that uses the 'googletag.cmd.push' function to define an array of slot configurations for all the ads you wish to display on a page.
Here's a sample code for configuring 3 ad slots using a single GPT:
googletag.cmd.push(function() { googletag.defineSlot("/111/example.com/electronics", [700, 200], "div-gpt-ad-987654321-0").addService(googletag.pubads()).setTargeting("slot_var", "tv"); googletag.defineSlot("/222/example.com/electronics", [250, 170], "div-gpt-ad-987654321-1").addService(googletag.pubads()).setTargeting("slot_var", "dvd player"); googletag.defineSlot("/333/example.com/electronics", [300, 100], "div-gpt-ad-987654321-2").addService(googletag.pubads()).setTargeting("slot_var", "smartphone"); googletag.pubads().enableSingleRequest(); googletag.pubads().enableSyncRendering(); googletag.enableServices(); });
TIP: You may choose to use the "u.gptSlots.push()" method instead of "googletag.cmd.push" and reference the NC+TAU value from a data source.
Example: u.gptSlots.push([b.GPT_SlotID, [[728, 90]], 'div-gpt-ad-987654321-0', {"place":"london","theme":"sports"}]);
Copyright All Rights Reserved © 2008-2022