JSPM

@clearcodehq/openrtb

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 164
  • Score
    100M100P100Q95612F
  • License MIT

Library with OpenRTB spec types which allows to build and validate OpenRTB objects

Package Exports

  • @clearcodehq/openrtb

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@clearcodehq/openrtb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenRTB

Overview

This is a Node.js library with OpenRTB v2.5 and v3.0 types. Library allows to build and validate OpenRTB objects.

Installation

For npm:

  • npm i @clearcodehq/openrtb --save-dev

For yarn:

  • yarn add @clearcodehq/openrtb --dev

Usage

To use the OpenRTB v2.5 types, import the package into your file:

import { OpenRTB25 } from '@clearcodehq/openrtb'

const request: OpenRTB25.BidRequest = {
  id: '0123456789ABCDEF',
  imp: [],
}

const response: OpenRTB25.BidResponse = {
  id: '0123456789ABCDEF',
  seatbid: [
    {
      bid:[
        {
          id: "3388668784683234620",
          impid: "1234",
          price: 0.01594973499743546,
          adm: "<div>test</div>",
          adid: "1234",
          adomain: [
            "https://example.com"
          ],
          iurl: "https://example.com/cr?id=1234",
          cid: "1234",
          crid: "1234",
          w: 160,
          h: 600,
        }
      ],
      seat: "bidder"
    }
  ],
  cur: "EUR"
}

The same with OpenRTB v3.0 types:

import { OpenRTB30 } from '@clearcodehq/openrtb'

const request: OpenRTB30.BidRequest = {
  openrtb: {
    ver: '3.0',
    domainspec: 'adcom',
    domainver: '1.0',
    request: {
      id: "0123456789ABCDEF",
    },
  }
}

const response: OpenRTB30.BidResponse = {
  openrtb: {
    ver: '3.0',
    domainspec: 'adcom',
    domainver: '1.0',
    response: {
      id: "0123456789ABCDEF",
      bidid: "0011223344AABBCC",
      seatbid: [
        {
          seat: "XYZ",
          bid: [
            {
              id: "yaddayadda",
              item: "1",
              deal: "1234",
              price: 1.50,
              macro: [
                {
                  key: "TIMESTAMP",
                  value: "1127987134"
                },
                {
                  key: "CLICKTOKEN",
                  value: "A7D800F2716DB"
                }
              ],
            }
          ]
        }
      ]
    }
  }
}