Sources
Sources are the entry points for event data in walkerOS. They capture events from different environments and formats, then transform them into standardized events that the collector can process.
How sources work
Sources capture events in their native format and send them to the collector:
- Capture: Listen for events (DOM clicks, API calls, player actions)
- Transform: Convert to walkerOS event format (
entity action
, data) - Send: Forward to collector for processing and routing to destinations
Available Sources
Browser
Captures events from web pages using DOM attributes:
- DOM interactions (clicks, form submissions, visibility)
- Automatic session and pageview tracking
- Custom data attributes (
data-elb-*
)
dataLayer
Integrates with existing analytics implementations:
- Works with GA4 and GTM dataLayer
- Event transformation and filtering
- Gradual migration support
Basic Setup
Sources are configured in startFlow
:
import { startFlow } from '@walkeros/collector';
import { sourceBrowser } from '@walkeros/web-source-browser';
const { collector, elb } = await startFlow({
sources: {
browser: {
code: sourceBrowser,
config: {
settings: {
pageview: true,
session: true,
prefix: 'data-elb',
},
},
},
},
destinations: {
/* your destinations */
},
});
// elb is now browser.push (enhanced with DOM commands)
// Use elb for manual event tracking
await elb('product view', { id: 'P123', name: 'Laptop' });
Primary Source
startFlow
returns an elb
function based on your sources:
- With sources: Returns first source's
push
method (enhanced features) - Multiple sources: First source is primary by default
- No sources: Returns
collector.push
(basic functionality)
Override Primary Source
const { elb } = await startFlow({
sources: {
browser: { code: sourceBrowser },
dataLayer: { code: sourceDataLayer, primary: true }, // Override
},
});
// elb is now dataLayer.push instead of browser.push
Reactive Event Handling
Sources can react to collector events via the optional on
method:
const mySource: Source.Init = async (config, env) => {
return {
type: 'custom',
config,
on: async (event, context) => {
if (event === 'consent') {
// React to consent changes
}
},
};
};
Available Events:
consent
- Consent state changessession
- Session lifecycle eventsready
- Collector ready staterun
- Collector run events
Creating Custom Sources
See Create Your Own Source for a complete guide to building custom sources.
Next Steps
- Browser Source - DOM-based tracking
- DataLayer Source - Legacy integration
- Create Your Own - Custom source guide
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.