One event, four tools
This web flow sends one event stream to four analytics tools at once, with no per-tool mapping. The collector fans a single event out to every destination, and each tool receives it in its own native call shape.
{
"version": 4,
"flows": {
"default": {
"config": {
"platform": "web",
"bundle": {
"packages": {
"@walkeros/collector": { "version": "^4" },
"@walkeros/web-source-browser": { "version": "^4" },
"@walkeros/web-destination-gtag": { "version": "^4" },
"@walkeros/web-destination-amplitude": { "version": "^4" },
"@walkeros/web-destination-mixpanel": { "version": "^4" },
"@walkeros/web-destination-posthog": { "version": "^4" }
}
}
},
"sources": {
"browser": {
"package": "@walkeros/web-source-browser",
"config": { "settings": { "pageview": true } }
}
},
"destinations": {
"ga4": {
"package": "@walkeros/web-destination-gtag",
"config": {
"loadScript": true,
"settings": {
"ga4": { "measurementId": "G-XXXXXXXXXX", "pageview": false }
}
}
},
"amplitude": {
"package": "@walkeros/web-destination-amplitude",
"config": { "settings": { "apiKey": "test-project" } }
},
"mixpanel": {
"package": "@walkeros/web-destination-mixpanel",
"config": { "settings": { "apiKey": "test-project" } }
},
"posthog": {
"package": "@walkeros/web-destination-posthog",
"config": { "settings": { "apiKey": "phc_test" } }
}
},
"collector": { "run": true }
}
}
}The gtag destination adds gtag.js to the page only with "loadScript": true, and "pageview": false keeps gtag from sending a page_view of its own next to the browser source's page view, so GA4 does not count each page twice. The Amplitude, Mixpanel and PostHog destinations bundle their vendor SDK.
Run it
Save the config as flow.json and push an order event with all four destinations mocked, one --simulate per destination. Each simulation runs its destination on its own, so this compares how each vendor receives the event; it is not a fan-out check of one running flow. This needs @walkeros/cli 4.7.1 or later. Nothing is sent to any vendor:
npx walkeros push flow.json -e '{"name":"order complete"}' \
--simulate destination.ga4 --simulate destination.amplitude \
--simulate destination.mixpanel --simulate destination.posthogWith the Amplitude destination at 4.8.2 this bundle fails with No matching export ... for import "start"; until a fixed release, set every package in bundle.packages to "4.8.1", which builds and prints amplitude.initAll(...) in place of the amplitude.init(...) line below.
You should see, besides an Output: line naming the built bundle before each Simulating line:
Simulating destination: ga4
Simulating destination: amplitude
Simulating destination: mixpanel
Simulating destination: posthog
success: true
destination.ga4
mapping: none
call window.gtag("config","G-XXXXXXXXXX",{"send_page_view":false})
call window.gtag("event","order_complete",{"send_to":"G-XXXXXXXXXX"})
destination.amplitude
mapping: none
call amplitude.init("test-project",{"autocapture":false,"identityStorage":"none"})
call amplitude.track("order complete",{})
destination.mixpanel
mapping: none
call mixpanel.init("test-project",{"track_pageview":false,"autocapture":false})
call mixpanel.track("order complete",{})
destination.posthog
mapping: none
call posthog.init("phc_test",{"autocapture":false,"capture_pageview":false,"capture_pageleave":false,"loaded":"[Function loaded]"})
call posthog.capture("order complete",{})
Duration: 58844msWhat each tool receives
The collector fans the same event out to all four destinations, and each one forwards it in its own native call, as the simulation above prints:
gtag('event', 'order_complete', { send_to: 'G-XXXXXXXXXX' });
amplitude.track('order complete', {});
mixpanel.track('order complete', {});
posthog.capture('order complete', {});This covers routing: one event stream reaches four tools without per-tool code. Mapping covers the payload: per-destination rules reshape the same event into each tool's expected schema, like the GA4 add_to_cart mapping in GA4 ecommerce. Without mapping the name arrives in each tool's native call; with mapping the properties do too.
Next steps
- GA4 ecommerce: Map a product add into the GA4
add_to_cartevent - Mapping: Transform events per destination