Advertiser | Publisher | Internal

Yieldbot Synchronous Tagging with GPT (Google Publisher Tag)

Use of Yieldbot tagging breaks into three main areas:

This document describes both the use of the Intent Tag as well as ad tagging.

Document Styling

Code found in regular document text appears as:'1234');

This is regular code in references
This is highlighted code in references

Reference Code

The following reference code shows both the Yieldbot Intent Tag as well as the ad serving tagging for GPT in synchronous rendering mode with a simple example page.

<!doctype html>
<html lang="en-us">
    <meta charset="utf-8">
    <title>Example Publisher</title>
<script type="text/javascript">
(function() {
  var useSSL = 'https:' == document.location.protocol;
  var src = (useSSL ? 'https:' : 'http:') +
  document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
    <!-- Intent Tag -->
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">'1234');
    <!-- END Intent Tag -->
<script type="text/javascript">
googletag.defineSlot('/2516314/banner-unit', [728, 90], 'div-gpt-ad-1354229671420-0')
    .setTargeting('ybot_ad', yieldbot.adAvailable('728x90-banner'))
    .setTargeting('ybot_slot', '728x90-banner')
    <p>Page copy before ad.</p>
<!-- banner-unit -->
<div id="div-gpt-ad-1354229671420-0" style="width: 728px; height: 90px;">
<script type="text/javascript">
    <p>Page copy after ad.</p>

Yieldbot Intent Tag

The Yieldbot Intent Tag is shown in the first highlighted code above in the reference code, lines 16 through 23.

The Yieldbot Intent Tag brings state of the art analytics technology, data mining and realtime matching to your site. It is the collection mechanism for Yieldbot publisher analytics and the first step towards harvesting your site intent for increased visitor intelligence and monetization.

This tag can be used with or without ad serving, with no modification to the tagged page.


For ad serving with GPT in synchronous mode, the Yieldbot Intent Tag must come before the script tag that calls googletag.defineSlot(). It’s recommended that this tag be installed where it will need to be for ad serving even prior to enabling the Yieldbot advertising system.

In the example above, line 19 of the intent tag,'1234');, configures the unique identifier for the publisher site that it sits on – in this example the dummy value ‘1234’. To install Yieldbot on your site you must get your own version of the tag which will have the unique value assigned to your site for identification in the Yieldbot platform.

Line 20, yieldbot.defineSlot('728x90-banner');, defines the ad slots that are on the current page and visible to the Yieldbot advertising sytem. If not being used for ad serving, calls to defineSlot() will not be present. If ad serving is enabled then there should be a call to defineSlot() for each ad slot on the current page.

Ad Tagging

With the GPT code properly integrated with the Yieldbot Intent Tag, ad tagging is straightforward.

Line 27, adding the setTargeting('ybot_ad', yieldbot.adAvailable('728x90-banner')) call for the slot, signals to DFP whether Yieldbot has an ad available or not for the specified Yieldbot Ad Slot (in this case the one named ‘728×90-banner’).

Line 28, adding the setTargeting('ybot_slot', '728x90-banner') call for the slot, passes the Yieldot Ad Slot name to DFP, which is used in the returned creative when the Yieldbot campaign is selected.

DFP Configuration

The optional Yieldbot ad serving is accomplished by using the DFP “Custom Criteria” functionality. When Yieldbot has ads available the ad request will come in with a Custom Criteria of “ybot_ad” set to the value “y”.

The following is the thirdparty creative that gets configured in DFP for the Yieldbot campaign in the publisher ad server.

<!-- Creative Tag -->
<script type="text/javascript" src=""></script>
<script type="text/javascript">
    var ybotq = ybotq || [];
    ybotq.push(['renderAd', '%%PATTERN:ybot_slot%%']);
<!-- END Creative Tag -->