Table of contents

Setting up Klaviyo Server Side in Google Tag Manager

Klaviyo Server Side Tracking

Klaviyo 's integration with Google Tag Manager (GTM) via Server Side Tracking is a step forward in making your email marketing strategies more efficient. By using this method, you improve the precision of your data analysis, leading to more targeted and effective marketing efforts. Before you begin, it's important to make sure your GA4 configuration and events are set up correctly.

Note: Server-side integration in GTM only works if you know a user's email. This information is needed to associate users on your site with users in the Klaviyo database and add the required events and parameters.

What you must have configured before you begin:

  • Google Analytics 4 configured in the server container
  • Google Analytics 4 events created

What is Klaviyo?

Klaviyo is an email marketing platform that focuses on automating communication processes with customers via email. It provides segmentation, personalization and analytics capabilities that allow companies to more effectively address the needs and preferences of their target audience. Klaviyo integrates with a wide range of e-commerce platforms and other tools, streamlining the collection and use of customer data for marketing purposes.

example-claviyo-dashboard

Types of Events you Can Measure with Klaviyo

Within the Klaviyo and Google Tag Manager server side setup, there are three primary types of events you can measure to capture users' interactions with your Web site. Here's an overview:

  1. Active on Site:
    • This event type is designed to track when users are active on your site. It can be used to analyze how often and how long visitors view your site, which helps in understanding their engagement level.
  2. Event:
    • It records specific actions a user takes, such as adding an item to the cart or completing a purchase. This type of event tracking is crucial for understanding the path that leads to conversions and for optimizing the customer journey.
  3. Add to List:
    • This event is used to add users to specific Klaviyo lists, such as a list of recent buyers. It is useful for segmenting your contacts and sending personalized communications based on the actions they have taken on your website.

Note: Klaviyo you only need to set up server side . This is because Klaviyo does not currently support deduplication

Set active on site type

The 'Active on Site' type in Klaviyo allows us to monitor users' activity on the website and collect essential data about their interactions with the site.

Step 1: Create New Klaviyo Tag (Server Container)

Create a new tag within Google Tag Manager by navigating to Tags and click New to create a new tag. Then give the tag a name such as Klaviyo - active on site.

create-new-tag-google-tag-manager

Step 2: Tag Configuration (Server Container)

In the tag configuration, choose Discover more tag types in the community template gallery. Then search for the Klaviyo template and add import this template.

import-claviyo-template-gtm

Step 3: Klaviyo Tag Setup with Private API Key (Server Container)

The next step is to set up the Active on Site type where you enter your Klaviyo Private API Key. You'll find this key in your Klaviyo dashboard under Settings and then API Keys, where you can generate and copy the key for use in Google Tag Manager.

create-prive-api-key-klaviyo

Step 4: Email Variable (Server Container)

Add an email variable to the Klaviyo tag configuration. If you haven't created this variable before, now is the time to do so. Below is an example of an email variable. Note this may vary by data layer. Don't know what data layer you have? Check out our explanation of the Data Layer.

create-email-variable-gtm

Step 5: Klaviyo User ID (Server Container)

You add your Klaviyo User ID to the tag. This ID can be found in the Klaviyo dashboard under API Keys, where you will see your Public API Key.

public-api-key-klaviyo

Make sure you also enable the Use Optimistic Scenario and Store email in cookies options to ensure that email addresses are stored and used for an optimistic approach in data analysis. Below is an example of what the configuration might then look like:

klaviyo-active-on-site-configuration

Step 6: All Pages Trigger (Server Container)

As a final step, add the All Pages trigger to activate the Klaviyo tag on every page. With these settings, your Klaviyo tag is ready to track site-wide user activity.

klaviyo-active-on-site-tag-all-pages

Create event-based Klaviyo tag

Next, we are going to configure a Klaviyo tag based on specific events.

Step 1: Create New Tag Go inside Google Tag Manager (Server Container)

Go to the Tags section and click New to start a new tag. For example, name this tag as Klaviyo Events.

create-new-tag-google-tag-manager

Step 2: Klaviyo Events Tag Setup (Server Container)

When setting up the tag, choose the Event type. Enter your Klaviyo Private API Key here, along with the email variable and Klaviyo User ID you set up earlier. At Event Name, use the built-in variable event name. Again, activate the Use Optimistic Scenario and Store email in cookies options.

klaviyo-event-tag-configuration

Step 3: Add Custom Properties (Server Container)

You now have the ability to add custom properties to your event tag. These can range from general information to specific location information, depending on what you need for your data analysis.

add-custom-properties-claviyo-tag

It is important that the address is a string of street name. You cannot attach arrays, because of this Klaviyo event tag will give error.

Step 4: Add Triggers (Server Container).

Next, determine which events you want to measure, such as add_to_cart and purchase, and add them to your tag as triggers. If you are not yet familiar with creating these triggers, please refer to our tutorial blog on setting up events in Google Tag Manager.

add-triggers-to-klaviyo-event-tag

By following these steps, Klaviyo allows you to capture detailed information about user behavior, which is invaluable for refining your marketing campaigns and increasing your conversion rates.

Add to list type

In addition to Active on Site and event-based tags, Klaviyo also provides the functionality to add users to specific lists, such as a list for all buyers. Here's how to set up the Add to List tag in Google Tag Manager.

Step 1: Create New Tag (Server Container)

Start by creating a new tag by going to Tags in Google Tag Manager and clicking New. For example, name this tag Klaviyo - Add to List.

create-new-tag-google-tag-manager (2)

Step 2: Klaviyo Add to List Tag Setup (Server Container)

As the tag type, select Add to List. Next, enter your Klaviyo Private API Key and List ID. To find your List ID, in your Klaviyo account navigate to the Lists & Segments tab, select a specific list and go to the Settings tab. At the top of the page, you'll find your List ID.

find-list-id-klaviyo

Add the mail variable and check the Use Optimistic Scenario option; the rest of the settings can remain at the default values.

klaviyo-add-to-list-tag-configuration

Step 3: Klaviyo Add to List Trigger Setup (Server Container)

Then add the trigger you want to use for this tag, such as Purchase, because this action indicates when a user makes a purchase and is thus eligible to be added to the buyer list.

Klaviyo Add to List Trigger purchase

Following these steps will activate Klaviyo's Add to List functionality, giving you the ability to automatically add buyers to a segmented list for further marketing activities.

Outro - Measuring all Klaviyo events

We have now covered the three main types of events: 'Active on Site', 'Events' and 'Add to List'. With these settings in Google Tag Manager, you have a solid foundation for tracking and analyzing a wide range of user interactions within Klaviyo. This will enable you to increase the effectiveness of your email marketing campaigns and build a richer customer database for future targeting and segmentation. With this knowledge, you are now ready to take full advantage of all of Klaviyo's capabilities.

About the author

Recently published

magnifiercrossmenu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram