A dead simple wrapper for sending report pixel in the browser
- 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')
- Create a new Pixsend Instance:
const pixsend = new Pixsend({ src: 'https://www.google.com' }, { foo: 'bar' })
- Add data to the pixel:
pixsend.add({ more:'data', andMore:'something' })
- 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
To run Pixsend unit test run:
> npm test