collect Plugin

Send data into Lytics using the most appropriate transport

collect plugin

Send data into Lytics using the most appropriate of two available transports

  • a GET request using a gif pixel
  • a POST request using a form submission
Send
namespace collect
data collection utility

Config

{
  serializer: 'default'
}

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;

Generally, you won't be calling this method directly. It is exposed as API for backwards compatibility.

parameters

  • message Message The message to serialize and send
  • url string
  • isMock boolean When false, just serialize the message without actually sending it

Events

EventFires whenPayload
collect.startedcollect is called.The message to be sent
collect.finishedThe request succeedsThe message that was sent
collect.failedThe request failsNone

Learn more about events