Google Publisher Tag Manual

Google’s Doubleclick for Publishers is one of the most commonly used ad servers in the world.  In order to enable maximum control of your ad tags using the Mezzobit Tag Manager there are some steps you should follow.

This manual is based on the recommended setup found at Google’s Publisher Tag Support.  GPT is the abbreviation of Google Publisher Tags.

We recommend splitting the Google code into 3 convenient tags when setting up or migrating to our system.  This will allow you to set dependencies when necessary as well as enable rules and variables to affect each tag separately as necessary.

 

The three tags are:

  1. The GPT.js Initiation code
  2. The Define Slots tag with all your creative / ad locations
  3. The Display tag where the creative / ad will show

Note:  We are using examples that may not match your implementation.  Please do not use the code we show in screenshots unless you know it is correct.

 

1. GPT Initiation 

The GPT.js initiation code can be found in our Partner Tag area and should look like this:

For more information go to Google’s Code Reference

 

 

 

2. Slot Definition Tag 

All your defineSlot declarations can be placed into another tag dependent on the GPT Initiator Tag.

 

Set Dependency:

The first slot defined in the screenshot above uses Mezzobit TDI variables. For more information about setting up a variable in TDI, please see Mezzobit’s Variable Basics. The second slot defined represents a basic use case where all values are hardcoded into the tag. For more information, please visit DFP defineSlot documentation.

 

 

Setting Targeting:

As with the generic google set up of GPT, when you need to set targeting, simply set the target values when defining the slot. For more information go to Google’s Code Reference

 

 

Targeting can also be set dynamically and injected into the slots tag when needed.

Reference Mezzobit’s Variable Basics in our Support Documentation Area.

  

 

3. Display Tag 

Finally, your display tags should be made one for each location. They will contain the code used to display your ad creative.

This tag should be dependent on Slot Definition Tag as well as the GPT Initiator Tag.

 

Note: This is an example Div not the actual one you should use.  

 

Set Dependency:

 

 

 

 

Additional Feature Configurations

 

Single Request

Single Request enables Google’s Single Request Architecture (SRA). Making this request will call all ad slots on the page in one call. A reason not to call Single Request would be if you are calling DoubleClick Rich Media Dynamic ads which are not compatible. For more information go to Google: Choosing the right GPT mode

 

 

 

Collapse empty divs (when nothing is served)

Sets whether the div should be collapsed when there is no ad in the slot. This can be defined as a part of defineSlot.  Use this to cover up blank ad slots on the page.

For more information go to this collapseEmptyDivs documentation.

Note: If the need arises where the slot must be collapsed even before the ad is fetched, this can be done as well.

 

 

 

Refresh Ad Slots

In the case of lazy loading or whenever you need the ad slots to refresh with new ads, this call can be used. This function only works in Async mode. For more information, visit the Reload Ads Documentation.

If all ads should be refreshed: 

Note: If calling this from a tag, a rule should be used as a trigger (when to fire) and it should be dependent to the Slots tag.

 

 

 

Clear Targeting

Clears custom targeting for a given key. After this function is called the the value ‘sports’ would be removed from the ‘interests’ key.

For more examples, visit the Google Targeting Reference.

 

  

Update Correlator

When GPT assembles ad requests for a page view it creates a new “correlator” value.  This value is used for cache busting and also allows the ad server to identify same page ad requests for things like roadblocks.  If necessary this changes the correlator that is sent with ad requests, effectively starting a new page view.

Note: It only works in Async mode.

For more examples, visit the Cache-Busting with GPT documentation.

 

Note: If calling this from a tag, a rule should be used as a trigger (when to fire).

 

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.