collect Plugin
Send data into Lytics using the most appropriate transport
collect plugin
collect pluginSend data into Lytics using the most appropriate of two available transports
- a
GETrequest using a gif pixel - a
POSTrequest using a form submission
| Send |
|---|
namespace collect |
| data collection utility |
Config
{
serializer: 'default'
}serializer
serializer- Type
(data: any, namespace?: string) => string - Optional
- Defaults to the builtin serializer
Optionally, you can pass a function which will be used to serialize every incoming message to the wire protocol. Generally, this should not need to be configured; the builtin serializer will work for most users
API
collect(message: Message, url: string, isMock: boolean): void;
collect(message: Message, url: string, isMock: boolean): void;Generally, you won't be calling this method directly. It is exposed as API for backwards compatibility.
parameters
- message
MessageThe message to serialize and send - url
string - isMock
booleanWhen false, just serialize the message without actually sending it
Events
| Event | Fires when | Payload |
|---|---|---|
collect.started | collect is called. | The message to be sent |
collect.finished | The request succeeds | The message that was sent |
collect.failed | The request fails | None |
Updated 13 days ago
