@dot-event/ad

0.0.12 • Public • Published

ad

dot-event gpt ads

coke

Install

npm install dot-event @dot-event/ad

Usage

// Create dot-event instance
//
const dot = require("dot-event")()

// Create googletag init promise
//
const initPromise = new Promise(resolve => {
  window.googletag.cmd.push(() => {
    window.googletag.pubads()
    window.googletag.pubads().enableSingleRequest()
    window.googletag.enableServices()
    resolve()
  })
})

// Extend dot with ad listener
//
require("@dot-event/ad")(dot, { initPromise: initPromise })

// Display an ad unit
//
dot.ad({
  unit: {
    divId: "test",
    path: "/0123456/content1/science-and-chill",
    sizes: [300, 250],
  },
})

Options

Option Description
unit.divId googletag.defineSlot opt_div
unit.path googletag.defineSlot path
unit.sizes googletag.defineSlot size
unit.sizeMap googletag.sizeMapping sizeMapping
unit.a9 Attach A9 header bidding
unit.destroy Destroy unit at divId

Events

dot.any("adLoaded", console.log)
dot.any("adRendered", console.log)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.12
    0
    • latest

Version History

Package Sidebar

Install

npm i @dot-event/ad

Weekly Downloads

0

Version

0.0.12

License

MIT

Unpacked Size

20.4 kB

Total Files

7

Last publish

Collaborators

  • winton