Skip to main content

Collector Commands

The collector provides a core event processing engine that manages destinations, consent, user data, and custom properties. Commands are executed through the elb function

note

For browser-specific commands like DOM initialization and elbLayer communication, see Browser Source Commands.

destination

Add destinations to the collector for event processing. Destinations handle the actual delivery of events to third-party services.

Loading...
tip

Destinations are typically configured during collector initialization:

Loading...

See destination-specific documentation for configuration options.

Manage consent states for the collector. Names can be defined arbitrarily, but common groups are functional, analytics, and marketing. Values are booleans, and once a value is set to true it's treated as consent being granted.

Loading...

Setting a consent state to false will immediately stop a destination from processing any events. Previously pushed events during the run are shared with existing destinations once consent is granted.

info

Learn more about consent management in detail.

on

Add event listeners to the collector. They get called when specific events occur like run or consent changes.

Loading...

Options depend on type and can also be an array for multiple listeners at once.

run

With each run, the on-event will be called with instance as a parameter.

Loading...

Every time the run command is called, the function will be executed:

Loading...

Every time the consent changes, the rules-matching function(s) will be called with the parameters instance and consent.

Loading...

The onConsent function will only be called when the marketing consent changes:

Loading...

user

Set user identification data for the collector. There are three levels: user (company's internal ID), device (longer-term identifier), and session (temporary identification).

Loading...

User IDs are added to each event.

Loading...
warning

Use fully anonymized & arbitrary IDs by default and check your options with persistent user IDs with your data protection officer.

tip

Learn more about identification and user stitching

custom

Set custom properties that are added to each event processed by the collector.

Loading...

globals

Set global properties that are added to each event processed by the collector.

Loading...

hook

Hooks customize the default behavior of the collector. Available hooks include Push, DestinationInit, and DestinationPush. Hooks allow for validation, manipulation, or cancellation of default behavior.

Add hooks to the collector to customize or enhance default processing.

Loading...

Moments

The overall function execution order is as follows:

  1. prePush
  2. preDestinationInit
  3. postDestinationInit
  4. preDestinationPush or preDestinationPushBatch
  5. postDestinationPush or postDestinationPushBatch
  6. postPush

Others are:

  • preSessionStart
  • postSessionStart

Function signatures

In general, params will be prefixed as a parameter, containing fn which is the original function and result for the post-hooks. Use the following function signatures:

Loading...

Adding a hook

Add hooks during collector initialization or via the hook command:

Loading...
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.