Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

scm-spain/OpenAds-appnexus-prebid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 @adv-ui/openads-appnexus-prebid package on npm

To install the stable version:

npm install --save @adv-ui/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 '@adv-ui/openads'
import AppNexusConnector from '@adv-ui/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.