pixsend

3.0.0 • Public • Published

Pixsend

A dead simple wrapper for sending report pixel in the browser

Installation

  • Install with NPM
npm install --save pixsend
  • Require in the browser (use the file in the /dist folder)
<script type="text/javascript" src="js/pixsend-min.js"></script>
  • require in your browserify app (ES6)
const Pixsend = require('pixsend')
  • require in your browserify app (ES5)
const Pixsend = require('pixend/dist/pixsend-min.js')

Implementation

  1. Create a new Pixsend Instance:
const pixsend = new Pixsend({ src: 'https://www.google.com' }, { foo: 'bar' })
  1. Add data to the pixel:
pixsend.add({ more:'data', andMore:'something' })
  1. send the pixel:
pixsend.send()
  • You can also chain methods:
const pixsend = new Pixsend({ src: 'https://www.google.com' }, { foo: 'bar' })
pixsend.add({ more:'data', andMore:'something' }).send()
  • Pixsend also has a debug mode:
const pixsend = new Pixsend({ src: 'https://www.google.com', debug: true })
  • Pixsend can receive an src url with query strings and chain them to the final url:
const pixsend = new Pixsend({ src: 'https://www.google.com/?quesry=string' }, { foo: 'bar' })
pixsend.add({ more:'data', andMore:'something' }).send()
// https://www.google.com/?quesry=string&foo=bar&more=data&andMore=something

Tests

To run Pixsend unit test run:

> npm test

Readme

Keywords

Package Sidebar

Install

npm i pixsend

Weekly Downloads

1

Version

3.0.0

License

MIT

Unpacked Size

26.8 kB

Total Files

9

Last publish

Collaborators

  • amitosdev