Advertiser | Publisher | Internal

Yieldbot Asynchronous 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 asynchronous 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">
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') + 
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
<!-- Intent Tag LOADING -->
<script type="text/javascript">
var ybotq = ybotq || [];
(function() {
var js = document.createElement('script');
js.src = '';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(js, node);
<!-- Intent Tag ACTIVATION -->
<script type="text/javascript">
ybotq.push(function () {'1234');

<script type="text/javascript">
ybotq.push(function() {
googletag.cmd.push(function() {
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">
ybotq.push(function() {
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1354229671420-0'); });
    <p>Page copy after ad.</p>

Yieldbot Intent Tag

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.

When used asynchronously, the Yieldbot Intent Tag is split into two logical pieces. The first piece is the loading of the Intent Tag, shown above in lines 22 thru 31. The second piece is the activation of the Intent Tag, shown above in lines 33 through 41.

Intent Tag Loading

The first part of asynchronous operation of the Intent Tag is the loading portion, shown in the reference above in lines 22 through 31.

This part of the tag sets up the code for the Intent Tag to be loaded asynchronously. Technically this is the only piece of the Yieldbot tagging where the placement on the page matters for proper operation in asynchronous mode. This section must be before ANY of the googletag.cmd.push() calls on the page, as well as before the activation code for the Intent Tag (shown in the reference above as directly following).

Intent Tag Activation

Activation of the Intent Tag is shown above in lines 33 through 41. This portion of the tagging activates the Yieldbot Intent Tag making it functional.

In this example, line 36 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 37, yieldbot.defineSlot('728x90-banner');, defines the ad slots that are on the current page. There should be a call to defineSlot() for each ad slot on the current page.

Line 38, yieldbot.enableAsync();, puts the Yieldbot Intent Tag into asynchronous support mode.

Finally, the yieldbot.go(); call on line 39 puts the Intent Tag in motion.

Integration With GPT

With the Yieldbot Intent Tag in place in asynchronous operation mode, integration with GPT is fairly straightforward. This is illustrated above both in lines 44/53 and 62/64.

IMPORTANT All calls to googletag.cmd.push(function () {...}); need to be wrapped by ybotq.push(function () {...}); as shown in these examples.

Ad Tagging

With the GPT code properly integrated with the Yieldbot Intent Tag, ad tagging is straightforward. An example is illustrated above on lines 47 and 48.

Line 47, 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 48, 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 -->