Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@schibstedspain/openads-appnexus-prebid

2.0.3 • Public • Published

OpenAds AppNexus Prebid connector

Build Status codecov GitHub license npm version

About

OpenAds AppNexus connector with Prebid features.

OpenAds now support sources as modules by configuration so you can include whatever module available you want. To build your own module take a look at the section Build your own module

Installation

AppNexus Prebid module is available as the @schibstedspain/openads-appnexus-prebid package on npm

To install the stable version:

npm install --save @schibstedspain/openads-appnexus-prebid

Usage

To use it with OpenAds first you must install and import OpenAds as explained in the readme After that you must init the AppNexusConnector with the configuration member account and your especific Prebid configuration Now you are able to put the instance as a source available in OpenAds configuration

import OpenAds from '@schibstedspain/openads'
import AppNexusConnector from '@schibstedspain/openads-appnexus-prebid'
 
const appNexusConnector = AppNexusConnector.init({
  config: {
    member: 4242
  },
  prebidConfig: {
    core: {
      bidderTimeout: 1000,
      priceGranularity: "dense",
      enableSendAllBids: false
    },
    bidderSettings: {
      ...
    }
  }
})
 
const openAds = OpenAds.init({config:{
  Sources: {
    AppNexus: appNexusConnector
  }
}})

Configuration

Configuration object is divided in two objects:

  • config: related with AppNexus (ast.js)
  • prebidConfig: related with PreBid (pbjs.js)
    • core : (Optional) Settings to override the default Prebid core configuration.
    • bidderSettings: (Optional) Settings to override the default Prebid settings used by the bidders.

bidderSettings

An example of bidderSettings overriding the standard configuration applied to all bidders:

{
    standard: {
        adserverTargeting: [{
            key: "hb_bidder",
            val: function(bidResponse) {
                return bidResponse.bidderCode;
            }
        }, {
            key: "hb_adid",
            val: function(bidResponse) {
                return bidResponse.adId;
            }
        }, {
            key: "hb_pb",
            val: function(bidResponse) {
                return bidResponse.pbMg;
            }
        }, {
            key: 'hb_size',
            val: function (bidResponse) {
                return bidResponse.size;
            }
        }, {
            key: 'hb_source',
            val: function (bidResponse) {
                return bidResponse.source;
            }
        }, {
            key: 'hb_format',
            val: function (bidResponse) {
                return bidResponse.mediaType;
            }
        }, {
            key: 'hb_cache_id',
            val: function (bidResponse) {
                return bidResponse.videoCacheKey;
            }
        }, {
            key: 'hb_uuid',
            val: function (bidResponse) {
                return bidResponse.videoCacheKey;
            }
        }]
    }
}
 

More info can be found here.

Preconditions

This connector needs AppNexus Seller Tag (AST) and Prebid JS loaded in the page. Here an example:

<head>
    <script src="https://c.dcdn.es/prebid/fotocasa/dev/prebid.js" async></script> 
    <script src="https://acdn.adnxs.com/ast/ast.js" async></script> 
</head>

More info about:

Build your own module

This connector implements these Connector API interfaces:

  • AdViewable
  • AdLoadable
  • Logger

All modules to work fine with OpenAds must implement at least one interface of type AdLoadable or AdViewable The idea is that your module implements only the interfaces that support, for example AppNexus supports both

License

OpenAds is MIT licensed.

Install

npm i @schibstedspain/openads-appnexus-prebid

DownloadsWeekly Downloads

1

Version

2.0.3

License

ISC

Unpacked Size

41.7 kB

Total Files

20

Last publish

Collaborators

  • avatar