Tracking lab

Click tracking

Buttons marked up with data-track attributes; track.js turns each click into a Klaviyo.js call.

Lane C2 · Element attributesLane C1 · Standard Klaviyo script

Try it

Clicked Test CTA· track.jsLane C2 · Element attributes
Submitted Test Message· track.jsLane C2 · Element attributes

Sends the field's current text as the Message property.

Submitted Test JSON· track.jsLane C2 · Element attributes

The field must hold a JSON object; each key becomes a property.

Identifies this browser in Klaviyo.js. It can differ from the shop persona: the strip at the top shows both.

Viewed Booking· track.jsLane C2 · Element attributes

Reads booking_currency and booking_amount from the dataLayer at click time.

How it works

Each button carries data-track attributes. track.js reads them on click and calls klaviyo.track() (or klaviyo.identify() for data-identify-json). No page code is involved: that is lane C2, generic capture from element attributes.

Klaviyo.js comes from the site's GTM tag, so nothing is sent until that tag has run. A button flashes when track.js reports the call.

What to expect in the console

Each press adds a track.js · sent entry (or error), then an observed: track entry when the call reaches Klaviyo.js. A sent with no observed call means Klaviyo.js wasn't there to receive it.

If Klaviyo.js is anonymous (top strip), Klaviyo keeps the event against an anonymous visitor until you identify.

From the browser console

Change the booking values, or push a test event for the data layer bridge:

window.dataLayer.push({ booking_currency: 'EURO', booking_amount: 123.00 });

window.dataLayer.push({
  event: 'POC - Data Layer Bridge Test',
  test_id: 'manual-ssr-test-01',
  page_path: window.location.pathname,
  test_value: 42
});

console.table(dataLayer)
Full console