pixel Plugin
Send data using an img element
pixel plugin
pixel pluginSend data using an img element
| Pixel |
|---|
namespace pixel |
| pixel utility |
Interfaces
PixelOptions
PixelOptionsproperties
- 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
PixelSuccessCallback- Type
() => void;
PixelFailureCallback
PixelFailureCallback- Type
(reason: any) => void;
Plugin API
pixel(options: PixelOptions): void;
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 |
Updated 13 days ago
