Blog

Map Klaviyo events into sGTM via webhook

Klaviyo emits webhook events on every email open, click, and signup. Routing them through sGTM keeps the full picture in one warehouse.

Klaviyo's webhook integration sends events for almost every user action: signup, opt-in confirmation, email opens, link clicks, unsubscribes. Routing those events through your sGTM container means you can forward them to GA4, your warehouse, and your ad platforms with the same payload structure as your other events.

Set up the Klaviyo webhook

In Klaviyo, Account > Integrations > Webhooks > Add Webhook. URL: your sGTM webhook endpoint, for example https://data.example.com/webhook/klaviyo.

Select the events you care about. Common picks: Subscribed to List, Unsubscribed from List, Opened Email, Clicked Email, Marked Email as Spam.

In your sGTM container

Add a Webhook client listening on /webhook/klaviyo. The client parses the incoming JSON and emits an event with the Klaviyo payload as event data.

Klaviyo payload shape

{
  "event": "Opened Email",
  "customer_properties": {
    "$email": "jane@example.com",
    "$first_name": "Jane"
  },
  "properties": {
    "Campaign Name": "Spring Sale",
    "Message ID": "abc123",
    "URL": "https://example.com/sale"
  },
  "time": 1740000000
}

Map to GA4 events

In sGTM, add a GA4 tag with a trigger that fires when the incoming event name matches a Klaviyo event. Map the fields:

  • event_name: lowercase the Klaviyo name and replace spaces with underscores. "Opened Email" becomes opened_email.
  • user_data.email_address: customer_properties.$email (already lowercase, ready to hash for matching).
  • params.campaign_name: properties['Campaign Name']
  • params.message_id: properties['Message ID']

Authenticate the webhook

Klaviyo does not sign webhook payloads by default. To prevent spoofing, add a shared secret to the URL: https://data.example.com/webhook/klaviyo?token=YOUR_SECRET. In your sGTM client, check for the token and reject requests without it.

What to do with Subscribed events

Subscribed and Unsubscribed events are good signals to forward to your CRM and ad platforms for audience building. Send them to GA4 as conversion events; in your warehouse, write them to a subscriber state table that other queries can join against.