Accurate data collection is essential for building effective marketing strategies. Klaviyo can unify customer identifiers, stitch fragmented events together, and build a complete customer profile. When implemented correctly, Klaviyo's server-side tracking allows brands to collect cleaner data, match users across devices and sessions, and improve the accuracy of automations.
In this guide, we will explore how to get precise data from Klaviyo, enabling you to harness the full capabilities of Klaviyo by effectively 'backfilling' would-be anonymous events.
Before we dive into how to, let’s briefly see what we’re working with.
Identity resolution refers to the process of maintaining a unified customer record, regardless of the various identifiers (e.g. email, phone number, etc.) used across different touchpoints or devices. As customers interact with your brand across different channels, Klaviyo checks for opportunities to merge these engagements under a single customer profile.
This is based on a process called identifier precedence, where Klaviyo uses existing data to determine if these omni-channel engagements can be consolidated under a single, stronger identifier. Klaviyo ranks these identifiers as:
Today we are looking at Anonymous ID, for two main reasons:
As explained above, Klaviyo requires at least one identifier to create a profile entity for tracking events. Our goal is to add an anonymous ID to our tracking tags. This includes tags where an email is always expected (e.g., Purchase) as well as those where an email is only occasionally expected (e.g., Active on Site, View Item).
We need something persistent that lasts at least for a single session, ideally even longer. You can use cookies that your tracking stack already generates, like FPID from GA4, _fbp from Facebook, or another persistent cookie, storage, or variable. For the purposes of this guide we will use Stape User ID as our anonymous identifier. We will also assume you have a basic Klaviyo setup, as described in our setup guide.
1. Make sure the User ID power-up is turned on (alternatively, you can replace it with any other persistent id you have access to and skip this step in such case).

2. Create a Request Header variable in your server GTM to pick up User ID value.

3. Assign your variable as Anonymous ID in Klaviyo tags.


| Both our anonymous events, and events carrying email will now share Anonymous ID, making it possible to resolve them to a single profile. |
4. Test & publish!
Now let's check this in action:
202 status) because it carries one of the supported identifiers.



➡️ Note: had we identified ourselves with an email that already had a record in Klaviyo - a profile merge would occur automatically combining our historical data with the anonymous session, as can be seen below.

By using the capabilities of Klaviyo API combined with tools from Stape, we can now collect anonymous events to our Klaviyo in a way that they will ultimately resolve to actual emails, once customers identify themselves.
In our trial run with a partner shop over a week native Klaviyo tracking delivered:
Comments