← Tracking lab

Data layer helper and Klaviyo test lab

This page simulates GTM injecting Google's original DataLayerHelper and a thin Klaviyo adapter. It varies when the helper, dataLayer, event pushes, and Klaviyo.js appear. Success means each eligible event-bearing message reaches the selected Klaviyo API exactly once. The shared denylist excludes gtm.js, gtm.dom, and gtm.load. The bridge does not inspect or replace Klaviyo's network delivery.

Scenario A — helper arrives after dataLayer messages

The page pushes one state update and one event before the helper starts. With replay on, Google's helper listener sees the earlier event; replay off intentionally demonstrates a parity failure. Add ?missingDataLayer=1 to start before dataLayer exists; the adapter waits for the layer, then replays its queued messages.

Use ?missingDataLayer=1 to start without a layer.

Scenario B — every event message

Every object message with a string event field passes through unless its name is in the shared denylist; all other fields become event properties. State-only pushes update Google's helper model but do not become Klaviyo events. The optional API checkbox selects klaviyo.push(['track', ...]); otherwise the bridge calls klaviyo.track().

Scenario C — events before and after identify

Push an event before identification, call klaviyo.identify(), then push another event. The default path calls klaviyo.track() for each event; the optional mode uses klaviyo.push. The page records API return behavior but does not inspect Klaviyo's internal queue.

Run log

Helper not started. Klaviyo script is loading asynchronously.


    

Current helper model

(helper not started)

Current dataLayer messages


    

Interpretation limits

“Queued to Klaviyo” means the page called Klaviyo's supported JavaScript API. It does not prove a request left the browser or an event appeared in an account. An anonymous browser may not have a profile to associate with an event. No email or other identifying value is sent until you press Identify; use only a test address.

Browser lifecycle timeline and proof status

Markers reflect Playwright runs at the Klaviyo JavaScript API boundary. Green means each test event reached the selected API once in a controlled run; amber marks an intentional failure or an untested condition. HTTP delivery is outside this test.

  1. Page messages precede helper: existing event is replayed once by the original helper with listenToPast:true. 1 API call
  2. Klaviyo.js precedes helper: the helper processes history after injection. 1 API call per event
  3. Helper precedes Klaviyo.js: messages are retained until the selected API appears. 1 API call per event
  4. Push occurs while Klaviyo loads: pending live event and historical event each arrive once. 2 events, 2 calls
  5. dataLayer appears after helper: adapter waits, attaches, then replays messages. 1 API call
  6. Replay disabled: prior event is not forwarded. 0 calls; expected parity failure
  7. SPA A/B before identify: identity-aware bridge sends navigation events through klaviyo.push(['track', ...]). Observed with real script
  8. Identify: klaviyo.identify({ email }) resolved for the labeled test profile and isIdentified() became true. Real script, headed Chrome
  9. SPA after identify: navigation events use klaviyo.track(); identify-first and identify-last arms showed the method switch. Real script, separate contexts
  10. Page exits / browser suspends: delivery and internal queue persistence are Klaviyo's boundary and were not inspected. Out of scope