Native Content-Driven Advertising Example 2

In the previous blog, I mentioned there are two approaches to do Native Content-Driven Advertising and showed you how to manually target keywords and IAB Categories. In this blog, I describe how to do it automatically using AdRelevantis Content-Analysis service.

In your page head, add the following code.

//www.adrelevantis.com/js/dev/prebid.js
//www.adrelevantis.com/js/contentdriventag.js
<script>
  var adUnits = [
    {
      code: 'div1',
      sizes: [
        [300, 300]
      ],
      mediaTypes: {
        native: {
          title: {
            required: true
          },
          image: {
            required: true
          },
          sponsoredBy: {
            required: true
          }
        }
      },
      bids: [{
        bidder: 'adrelevantis',
        params: {
          placementId: 13232354,
          allowSmallerSizes: true
        }
      }]
    },
    {
      code: 'div2',
      sizes: [
        [300, 300]
      ],
      mediaTypes: {
        native: {
          title: {
            required: true
          },
          image: {
            required: true
          },
          sponsoredBy: {
            required: true
          }
        }
      },
      bids: [{
        bidder: 'adrelevantis',
        params: {
          placementId: 13232354,
          allowSmallerSizes: true
        }
      }]
    },
    {
      code: 'div3',
      sizes: [
        [300, 300]
      ],
      mediaTypes: {
        native: {
          title: {
            required: true
          },
          image: {
            required: true
          },
          sponsoredBy: {
            required: true
          }
        }
      },
      bids: [{
        bidder: 'adrelevantis',
        params: {
          placementId: 13232354,
          allowSmallerSizes: true
        }
      }]
    }
  ];
  
  var pbjs = pbjs || {};
  pbjs.que = pbjs.que || [];
  
  var adDivIds = ['div-1','div-2','div-3'];
  document.addEventListener("DOMContentLoaded", function(event){ adrtags("D435C107A8844E15BAA5D4A9B7D94FC5", adUnits, adDivIds); });
</script>

The code creates three ad units, each corresponds one <div> tag in the page.

<div id='div-1'>
</div>
<div id='div-2'>
</div>
<div id='div-3'>
</div>

You can put these tags anywhere you want in the page.

When the page opens, the DOMContentLoaded event handler analyzes the page content to get its IAB Categories and top keywords; the Categories and keywords are sent as request parameters; the SSP and DSP bids based on the request parameters; the matched native ads are displayed.

You can find a working example at https://github.com/ghguo/adrhbexamples/blob/master/ContentExamples/essential-french-onion-soup.html. Need more info? Drop us a line at <info@adrelevantis.com>.

Native Content-Driven Advertising Example

There are two approaches to do Native Content-Driven Advertising using AdRelevantis Bidder Adapter: Manually target keywords and IAB Categories, or use AdRelevantis Content-Analysis service. In this blog, we focus on manually targeting keywords and IAB Categories.

We assume that you know basic programming in Prebid.js. Please go here if you are new to Prebid.js.

Assuming that in a page you want to display ads that are related to golf US Open, you can provide the keywords and IAB Categories as First Party Data (fpd) as follows.

pbjs.setBidderConfig({
  bidders: ['adrelevantis'],
  config: {
    fpd: {
      context: {
        keywords: ['US Open'],
        data: {
          category: '/sports/golf'
        }
      }
    }
  }
});

You can find the complete code of this example at https://github.com/ghguo/adrhbexamples/blob/master/native-example.html.