pixel Plugin
Last updated September 8, 2026
Send data using an img element
`pixel` plugin
Send data using an img element
| Pixel |
|---|
| namespace pixel |
| pixel utility |
Interfaces
PixelOptions
properties
- src string - the URL of the pixel to send data to
- success optional PixelSuccessCallback - a callback to call on success
- failure optional PixelFailureCallback - a callback to call on failure
PixelSuccessCallback
- Type () => void;
PixelFailureCallback
- Type (reason: any) => void;
Plugin API
pixel(options: PixelOptions): void;
Send data using an img element.
parameters
- options PixelOptions
example
jstag.use(plugin => {
plugin.pixel({
src: 'https://doesnt.exist/pixel.gif?data=whatever',
success() {
console.log('data sent!');
},
failure() {
console.error('data not sent!');
}
})
});Mechanism
This plugin works by appending an <img> element to the DOM.
Events
| Event | Fires when | Payload |
|---|---|---|
| pixel.succeeded | the pixel request completes successfully. | the pixel URL |
| pixel.failed | the pixel request fails. | the pixel URL |