Bazaarvoice creates custom ad markup based on the information that you provide. The markup that Bazaarvoice creates follows the DFP best practice guidelines. This topic provides

  • Examples of custom markup
  • Dynamically generated fields that you might need to provide in your ad markup
  • Best practices to use when working with ad markup

Custom markup examples

Expand the following sections for examples of custom markup that Bazaarvoice might provide to you. You will dynamically generate the fields that are italicized. Refer to Dynamically-generated fields for definitions of the dynamically generated content that your implementation might require.

<!-- Copy and paste this tag in the <head> section of your HTML -->
<!-- Source: /snippet/controltag?confid=JSrwx-gK&site=&edit=1 -->
<script class="kxct" data-id="JSrwx-gK" data-timing="async" data-version="1.9" type="text/javascript">
  window.Krux||((Krux=function(){Krux.q.push(arguments)}).q=[]);
  (function(){
    var k=document.createElement('script');k.type='text/javascript';k.async=true;
    var m,src=(m=location.href.match(/\bkxsrc=([^&]+)/))&&decodeURIComponent(m[1]);
    k.src = /^https?:\/\/([a-z0-9_\-\.]+\.)?krxd\.net(:\d{1,5})?\//i.test(src) ? src : src === "disable" ? "" :
      "https://cdn.krxd.net/controltag?confid=JSrwx-gK";
    var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(k,s);
  }());
</script>

<script>
window.Krux||((Krux=function(){Krux.q.push(arguments);}).q=[]);
(function(){
  function retrieve(n){
    var m, k='kxbazaarvoice_'+n;
    if (window.localStorage) {
        return window.localStorage[k] || "";
    } else if (navigator.cookieEnabled) {
        m = document.cookie.match(k+'=([^;]*)');
        return (m && unescape(m[1])) || "";
    } else {
        return '';
    }
  }
  Krux.user = retrieve('user');
  Krux.segments = retrieve('segs') && retrieve('segs').split(',') || [];
})();
</script>
<!-- Start: GPT Async -->
<script type='text/javascript'>
 var gptadslots=[];
 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:') + '//www.googletagservices.com/tag/js/gpt.js';
  var node = document.getElementsByTagName('script')[0];
  node.parentNode.insertBefore(gads, node);
 })();
</script>

<script type="text/javascript">
 googletag.cmd.push(function() {

  //Adslot 1 declaration
  gptadslots[1]= googletag.defineSlot('/5705/bv.YOURSITE/{CATEGORY}', [[{w},{h}]],'div-gpt-ad-YOURSITE_{CATEGORY}-1').setTargeting('subcat','{SUBCAT}').setCategoryExclusion('{CATEGORY}').addService(googletag.pubads());

  //Adslot 2 declaration
  gptadslots[2]= googletag.defineSlot('/5705/bv.YOURSITE/{CATEGORY}', [[{w},{h}]],'div-gpt-ad-YOURSITE_{CATEGORY}-2').setTargeting('subcat','{SUBCAT}').setCategoryExclusion('{CATEGORY}').addService(googletag.pubads());

  //Adslot 3 declaration
  gptadslots[3]= googletag.defineSlot('/5705/bv.YOURSITE/{CATEGORY}', [[{w},{h}]],'div-gpt-ad-YOURSITE_{CATEGORY}-3').setTargeting('subcat','{SUBCAT}').setCategoryExclusion('{CATEGORY}').addService(googletag.pubads());

  googletag.pubads().setTargeting("ksg", Krux.segments);
  googletag.pubads().setTargeting("kuid", Krux.user);
  googletag.pubads().setCategoryExclusion('retailer');
  googletag.pubads().setCategoryExclusion('{CATEGORY}');
  googletag.pubads().collapseEmptyDivs();
  googletag.pubads().enableAsyncRendering();
  googletag.enableServices();
 });
</script>
<!-- End: GPT -->
<!-- Copy and paste these tags in the <body> section of your HTML -->
<!-- Beginning Async AdSlot 1 for Ad unit bv.YOURSITE/{CATEGORY}  ### size: [[{w},{h}]] -->
<!-- Adslot's refresh function: googletag.pubads().refresh([gptadslots[1]]) -->
<div id='div-gpt-ad-YOURSITE_{CATEGORY}-1'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('div-gpt-ad-YOURSITE_{CATEGORY}-1'); });
 </script>
</div>
<!-- End AdSlot 1 -->

<!-- Beginning Async AdSlot 2 for Ad unit bv.YOURSITE/{CATEGORY}  ### size: [[{w},{h}]] -->
<!-- Adslot's refresh function: googletag.pubads().refresh([gptadslots[2]]) -->
<div id='div-gpt-ad-YOURSITE_{CATEGORY}-2'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('div-gpt-ad-YOURSITE_{CATEGORY}-2'); });
 </script>
</div>
<!-- End AdSlot 2 -->

<!-- Beginning Async AdSlot 3 for Ad unit bv.YOURSITE/{CATEGORY}  ### size: [[{w},{h}]] -->
<!-- Adslot's refresh function: googletag.pubads().refresh([gptadslots[3]]) -->
<div id='div-gpt-ad-YOURSITE_{CATEGORY}-3'>
 <script type='text/javascript'>
  googletag.cmd.push(function() { googletag.display('div-gpt-ad-YOURSITE_{CATEGORY}-3'); });
 </script>
</div>
<!-- End AdSlot 3 -->

Dynamically-generated fields

The markup includes fields that you will dynamically generate on a page-by-page basis. Dynamically generating these fields

  • defines your sellable inventory
  • provides the Bazaarvoice sales team with multiple selling opportunities
  • increases your revenue

Depending on your site needs, your custom markup might contain one or more of these fields. You must generate content for any fields that your markup includes. Expand the following section for definitions of the dynamically-generated fields that you might need to supply.

FieldDefinition
{category}The top line category as defined by your taxonomy tree. Your taxonomy tree is unique to your site and defines product categories hierarchically.
{searched_keyword}The consumer search query. Use "kw=null" if not applicable. Use an underscore (_) or a hyphen (-) to separate words.
{subcat}The sub-category (if applicable) as defined by your taxonomy tree.
{brand}The brand of the product (for example, http://www.YOURSITE.com/product_name.html). Use "brand=null" if not applicable. Use an underscore (_) or a hyphen (-) to separate words.
{pos}The position of the ad. Specify "above the fold" ({pos=atf}) if the ad is above the middle of the page or "below the fold" ({pos=btf}) if the ad is below the middle of the page.
{w}x{h}The pixel dimensions of the ad, where {w} is width and {h} is height.
[timestamp]A dynamically-generated random number. Populating this prevents ads from caching on the site by ensuring that each visit to the page—even if it is the same user navigating away from and back to the page—is deemed a unique call to the ad server.

Ad markup best practices

Expand the following sections for best practices to remember when working with your custom ad markup.

Certain ad unit sizes (also called IAB units) are easier to sell and scale than others. For maximum revenue potential, adhere to the following ad sizes.

  • 728x90
  • 300x250
  • 160x600

Bazaarvoice provides DFP markup in iframe/javascript, javascript-only, or noscript format. Understanding your needs for your page will help Bazaarvoice create the appropriate markup.

  • iframe/javascript—Allows a "house/non-paid" ad to serve when no ads are directly sold. This method is most useful if there are any internal marketing campaigns that you would like to run while the space is not being monetized.
  • javascript-only—Allows the ad space to collapse when no ads are directly sold. This method is most useful when you want to minimize consumer interruption when the space is not being monetized.

Your ad markup contains both a javascript and a noscript tag. This allows flexibility for different technical situations, such as devices that cannot display Javascript content.

  • script—displays a rich media version of the ad.
  • noscript—displays an image-only back-up version of the ad.

The following characters are not permitted in DFP markup.

Forbidden characterReplacement character
© (copyright symbol)remove completely
® (registered trademark symbol)remove completely
(trademark symbol)remove completely
. (dot)_ (underscore) or - (hyphen)
/ (slash)_ (underscore) or - (hyphen)
" (double apostrophe)_ (underscore) or - (hyphen)
' (single apostrophe)_ (underscore) or - (hyphen)

DFP uses zones and key-values to identify the type of content that is on the page. Once the page has been tagged with the appropriate DFP zone and/or key-value information, an ad will be targeted to that unique zone and/or key-value.