Stape
Search
Try for free

Klaviyo Lookup variable for Google Tag Manager server container

Published
Sep 23, 2024

Klaviyo is a marketing automation platform primarily used for email and SMS campaigns. It's popular because it allows businesses to create highly personalized marketing messages based on customer behavior, purchase history, and other data. Klaviyo integrates seamlessly with e-commerce platforms like Shopify, making it easy to set up targeted campaigns that drive engagement and sales.

Klaviyo Lookup variable enables interaction with Klaviyo's API. In this post we will discuss how it works and how to set it up in your server Google Tag Manager container.

The initial development of this template was done by Lars Friis, and it is now maintained by Stape.

How it works

Klaviyo Lookup variable checks for a specific cookie, called ‘kx’ or ‘_stape_kx' (set by Stape Klaviyo tag for sGTM) which is automatically generated by Klaviyo when a user interacts with Klaviyo-powered emails or other tracking mechanisms. This variable is configured to fetch user data from Klaviyo, depending on the presence of the 'kx' cookie, and can return either the user's email or more comprehensive user data, such as their phone number, first name, and last name.

The primary use case for this variable is to enhance data collection and targeting capabilities in server-side tracking environments. For example, if a user clicks on a link in a Klaviyo email and visits a website, they would typically have the 'kx' cookie set in their browser. The Klaviyo Lookup Variable can then retrieve this user's data from Klaviyo's database and use it to enhance the data sent to other marketing platforms like Facebook or Google Ads. This can improve personalization, retargeting efforts, and data consistency across platforms.

How to set up Klaviyo Lookup variable

1. Download the Klaviyo Lookup variable from GitHub

Download the Klaviyo Lookup variable from GitHub

2. Import the variable to your server Google Tag Manager by clicking: Templates → New Variable Template → Click three dots in the top right corner → Click import → Add template that you’ve recently downloaded.

Import the variable to your server Google Tag Manager

3. Add your Api Key and choose the output: Email or All user_data. Click Save.

klaviyo lookup variable configuration

Conclusion

Klaviyo Lookup variable setup is particularly valuable for enhancing user data continuity between different marketing platforms, improving cross-channel personalization, and ensuring that marketing efforts are well-coordinated across multiple touchpoints.

You can find more information about Klaviyo in our blog:

Tagged with:gtm server

Try Stape for all things server-sideright now!