Skip to main content

node-tracker.payloadbuilder

Home > @snowplow/node-tracker > PayloadBuilder

PayloadBuilder interface

Interface for mutable object encapsulating tracker payload

Signature:
interface PayloadBuilder 

Properties

PropertyTypeDescription
add(key: string, value: unknown) => voidAdds an entry to the Payload
addContextEntity(entity: SelfDescribingJson) => voidCaches a context entity to be added to payload on build
addDict(dict: Payload) => voidMerges a payload into the existing payload
addJson(keyIfEncoded: string, keyIfNotEncoded: string, json: Record<string, unknown>) => voidCaches a JSON object to be added to payload on build
build() => PayloadBuilds and returns the Payload
getJson() => EventJsonGets all JSON objects added to payload
getPayload() => PayloadGets the current payload, before cached JSON is processed
withJsonProcessor(jsonProcessor: JsonProcessor) => voidAdds a function which will be executed when building the payload to process the JSON which has been added to this payload