1.0.0 • Published 8 years ago

isocket-targeting v1.0.0

Weekly downloads
43
License
ISC
Repository
github
Last release
8 years ago

isocket-targeting Build Status NPM version

Global Targeting Types for Node.js provides easy access to common ad targeting types based on the isocket API

Install

npm install isocket-targeting --save

Usage

const Targeting = require('isocket-targeting')

Targeting.sync((err) => {
  if (err) throw err

  Targeting.findByUid('T-GEO_US', (err, targeting) => {
    if (err) throw err

    console.log(targeting.name) // => United States
  })
})

API

sync

Loads data synchronously. Mostly provided as backwards compatibility with pre-v1. Optionally takes a callback argument.

Targeting.sync()

getType

Given a type of geo or fcap returns list of targetings

Targeting.getType('fcap', (err, targetings) => {
  assert.ok(targetings.length)
})

findAllByType

Alias of getType

findByUid

  1. Given a targeting UID returns a targeting
  2. Given a list of targeting UIDs returns a list of targetings
  3. If no targetings are found returns null
Targeting.findByUid('T-GEO_US', (err, targeting) => {
  assert.equal(targeting.name, 'United States')
})

getGeoTree

Returns a tree of root -> countries -> DMAs. Each child is a targeting.

Targeting.getGeoTree((err, tree) => {
  assert.ok(tree.hasOwnProperty('children'))
  assert.ok(tree.children.length)
})

Test

npm test
1.0.0

8 years ago

0.2.0

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago