Monetization Framework

Quickstart Templates

The majority of use cases are covered by our quickstart templates and they allow you to get up and running very quickly.

1. Load monetization.js

Monetization.js is the base framework with everything you will need. Simply copy+paste the JavaScript code below into the <head> tag of your website:

JavaScript

<script
  src="//m.servedby-buysellads.com/monetization.js"
  type="text/javascript"
></script>

2. Create a target element where the ad will get injected

Best practice is to use a unique id for this element like so:

HTML

<div id="native-ad"></div>

3. Initiate the ad script with your own zonekey:

HTML

<script>
(function(){
  if(typeof _bsa !== 'undefined' && _bsa) {
    _bsa.init('default', 'CVADC53U', 'placement:demo', {
      target: '#native-ad',
      align: 'horizontal'
    });
  }
})();
</script>

Once the script is ready and the target element is available, you may call the script by running _bsa.init (as shown in the code above). The init function accepts these variables:

VariableDescription
templateThe template you’re using. Some of the templates you may choose are default, flexbar, fancybar, and custom.
zonekeyThe zone key you can get when you’re accepted in the Native Performance Network. For example, the demo zone key is CVADC53U.
placementThe placement name. Usually, you’ll use your domain name without any special characters. For example, for buysellads.com you’ll use buyselladscom as the placement name.

It also accepts options to customize the ad behavior. Here are some options you can pass:

OptionsDescriptionDefault Value
targetPass the ID of the element, so the script knows where to inject the ad.#default_demo
disable_cssThis allows you to disable the default CSS.false
alignOptions are horizontal or verticalhorizontal

That's it - those are the basics for getting started with the BuySellAds Monetization Framework. From here you might want to explore the various templates or look into building your own custom templates.