weltpixel

Klaviyo API Addon for Google Analytics 4 PRO

Requires the Google Analytics 4 PRO extension.

Klaviyo API Integration for Magento 2

Transform your Magento 2 store's marketing capabilities with our Klaviyo API integration. This powerful solution establishes a direct, secure connection between your e-commerce data and Klaviyo's marketing platform, enabling precise customer tracking and enhanced campaign optimization across all channels.

Designed specifically for Magento 2 merchants, this server-side implementation ensures reliable data collection and accurate customer tracking, even in environments with strict privacy settings or ad blockers.

Key Benefits of Klaviyo API Integration

Advanced Customer Tracking

Bypass browser limitations and tracking prevention tools with server-side implementation, ensuring comprehensive data collection for all customer interactions and behaviors on your Magento 2 store.

Enhanced Data Privacy Compliance

Meet modern privacy standards while maximizing marketing effectiveness. Our server-side integration gives you granular control over data sharing, ensuring compliance with privacy regulations while maintaining optimal campaign performance.

Future-Proof Implementation

Stay ahead of browser changes and privacy updates with a hybrid tracking approach that combines server-side reliability with client-side flexibility, ensuring consistent performance as digital marketing evolves.

Centralized Data Management

Consolidate your Magento 2 store's marketing data through a single, reliable API connection. Streamline tracking implementation while ensuring consistent measurement across all customer touchpoints and marketing channels.

How Klaviyo API Integration Works

Customer interacts with your Magento 2 store (purchases, cart updates, product views)

Server-side tracking captures event data with 100% reliability

Secure data transmission to Klaviyo via the official API

Real-time customer data appears in your Klaviyo dashboard

The following diagram illustrates the seamless integration between your Magento 2 store, Klaviyo server-side tracking, and the Klaviyo API:

Klaviyo API Integration Workflow for Magento 2

Features of the Klaviyo API Addon

Event Tracking

  • Server-side Placed Order Event Tracking
  • Server-side Selected Payment Method Event Tracking
  • Server-side Checkout Started Event Tracking
  • Server-side Added to Cart Event Tracking

Additional Events

  • Server-side Added to Wishlist Event Tracking
  • Server-side Product Searched Event Tracking
  • Server-side View Page Event Tracking
  • Server-side Viewed Product Event Tracking
  • Server-side Viewed Category Event Tracking
  • Server-side Created Account Event Tracking

Powerful Integration

  • Ability to track selected events in conjunction with the frontend Klaviyo tracking
  • Option to track events only for logged-in users
  • Directly and fully integrated into the Google Analytics 4 PRO extension
  • Ability to send data to multiple Klaviyo accounts

Developer Tools

  • Log functionality for in-depth debugging of events sent to the Klaviyo API
  • Easy setup, all that's required is the Klaviyo Private API Key
  • Option to track only specific customer groups

System Compatibility

  • Compatible with Magento 2.3.x - 2.4.8
  • Works with all Magento editions
  • Supports multiple store views

Requirements for using the Klaviyo API Addon

To use the Klaviyo API Addon, you'll need the following:

  • A Klaviyo account with access to the Private API Key. You can find this in your Klaviyo account under Settings → API Keys.
  • The Google Analytics 4 PRO extension enabled and configured.

How to Install the Klaviyo API Addon

1

Prerequisites

Before starting the installation, please ensure you have checked all requirements.
  • Ensure your Magento version is compatible (2.3.0 - 2.4.8 and all Security Patches)
  • Install on a testing environment first
  • Set Magento to developer mode
  • Make sure the Google Analytics 4 PRO extension is already installed and configured on your Magento 2 instance. You can find the steps for doing so in the Google Analytics 4 PRO User Guide.
php bin/magento deploy:mode:set developer
2

File Installation

Copy the extension files to your Magento 2 instance:

app/code/WeltPixel/GA4KlaviyoSS
If the 'app/code/WeltPixel' folder is missing, please create it manually.
3

Extension Installation

Run the following commands in your Magento root directory:

php bin/magento module:enable WeltPixel_GA4KlaviyoSS --clear-static-content
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
4

Cache Management

Flush any caches that you might still have enabled on your server or in Magento.
5

Production Mode

If your store was in production mode, switch it back:

php bin/magento deploy:mode:set production
6

Completion

The extension is now installed on your Magento store! Congrats!

How to Upgrade the Extension

1

Remove Old Files

Remove existing files from app/code/WeltPixel/GA4KlaviyoSS before upgrading.

The extension may be refactored and old unused files may cause random issues, so it's best to only keep the latest version of the files.

2

Follow Installation Steps

Follow the normal installation instructions above.

How to Configure the Klaviyo API Addon

Basic Configuration

Important Notice: To gain access to your Klaviyo Public API Key, you'll need to have a Klaviyo account. You can find your API key in your Klaviyo account under Settings → API Keys. This is crucial as you won't be able to use the server-side tracking without it.

Admin → WeltPixel → Google Analytics 4 Ecommerce PRO → Klaviyo API Settings

Enable Klaviyo Server Side Tracking

When enabled, the server-side Klaviyo functionality will use the Klaviyo Javascript Tracking code you configured in the section above.

Klaviyo Private API Key

Input your Klaviyo Private API Key. To find or generate a key, see the Klaviyo documentation.

Send events only for logged in users

In cases in which an email address is not available (for example, in a new session), Klaviyo automatically creates a new profile for the user browsing your website. If you don't want this to happen, and want to send events to Klaviyo only when the user is logged in, set this to Yes.

Track Events

Select the events you wish to send to Klaviyo via the API. Available options are:

  • View Page
  • Placed Order
  • Added to Cart
  • Added to Wishlist
  • Checkout Started
  • Product Searched
  • Viewed Product
  • Viewed Category
  • Created Account
  • Selected Payment Method (Payment Information)

Note: Make sure the Enable Klaviyo Pixel Tracking option in the section above is set to Yes, and that you've added your Klaviyo Pixel Tracking Public API Key.

Basic Configuration

Advanced Configuration

Advanced Configuration
Send enabled events via the frontend Klaviyo tracking as well

Set this option to Yes if you want to send events via the frontend Klaviyo tracking as well. This may (in some cases) enrich your data.

Enable File Log

Enable the creation of a log file that shows the pushed event data. The klaviyo-api.log file can be found in the var/log directory of Magento 2 root.

Track Only Specific Customer Groups

If set to Yes, only selected customer groups will be tracked by Klaviyo server-side events.

Send eCommerce Event Data to multiple Klaviyo endpoints

If set to Yes, you'll be able to add additional Klaviyo property IDs to which you want to send eCommerce event data to. You'll need the Klaviyo Private Api Key of each additional property you want to add. Note: Adding a new property here will only send the enabled eCommerce events in the Klaviyo Server Side Tracking configuration. If you need to also send Page View events, in order to stitch data and ensure attribution, you'll also need to add additional Klaviyo Pixel Tracking Public Api Key in the Klaviyo Pixel Tracking Public Api Key section above (you can specify it with comma separated list).

Support and Resources

Documentation

Access our comprehensive documentation in the Knowledge Base for detailed setup and configuration instructions.

Technical Support

Our dedicated support team is ready to assist you with any technical issues or questions you may encounter during setup and usage.

Regular Updates

Stay current with regular updates ensuring compatibility with the latest Magento versions and Klaviyo API changes.

Frequently Asked Questions

What is the Klaviyo API Addon?

The Klaviyo API Addon is an extension that enables server-side tracking of customer events from your Magento 2 store to Klaviyo, providing more accurate and reliable tracking data.

Do I need the Google Analytics 4 PRO extension?

Yes, this addon requires the Google Analytics 4 PRO extension to be installed and configured on your Magento 2 store.

What events can be tracked?

The addon supports tracking of various events including purchases, add to cart actions, product views, wishlist additions, checkout steps, and more.

How secure is the data transmission?

All data is transmitted securely using Klaviyo's official API endpoints with authentication and encryption.

Change Log

Version History

v.1.15.7 September 2, 2025
  • New Feature: Optimized the addon's event logging functionality to increase clarity and improve the process of searching/filtering through logged events. All data logged for a specific event is now included on the same line. Before this release, every logged piece of information would take up a separate line, even if related to the same eCommerce event.
  • New Feature: The addon now features the capability of sending data to multiple Klaviyo accounts via newly added Magento Admin settings. This allows you to send event data from the same Magento 2 instance to any number of Klaviyo accounts. This feature is also included in the Google Analytics 4 PRO extension and other API addons.
  • Magento Compatibility: Introduced compatibility with the latest released Magento 2 Security Patches - Magento 2.4.8-p2, Magento 2.4.7-p7, Magento 2.4.6-p12, Magento 2.4.5-p14 & Magento 2.4.4-p15.
  • Fixed an issue that would, in very specific cases, prevent the addon from sending purchase events via cron. This would happen when, for any reason, the ID of the product on the order that was supposed to be sent no longer existed (deleted product, for example).
  • Fixed an issue that would, in very specific cases, cause the checkout to break. This would only happen in very niche cases in which an order was detected as not having a valid payment method associated with it.
v.1.15.3 June 20, 2025
  • New Feature: Added options to allow for filtering of events based on Customer Groups. The extension now pulls all Customer Groups and allows merchants to select for which of those they'd like event data to be sent.
  • Magento Compatibility: Introduced compatibility with the latest Magento 2.4.8-p1, 2.4.7-p6, 2.4.6-p11 & 2.4.5-p13 Security Patches. Upgrade ASAP to keep your store secure.
  • Made various code optimizations related to Grand Total and Subtotal calculations in order to increase module customizability.
v.1.15.0 April 22, 2025
  • Magento Compatibility: Introduced compatibility with the new Magento 2.4.8 release, as well as the accompanying 2.4.7-p5, 2.4.6-p10, 2.4.5-p12 and 2.4.4-p13 Security Patches.
  • PHP Compatibility: Introduced compatibility with PHP 8.4, which is now officially compatible with the latest Magento 2.4.8 version.
v.1.10.1 April 7, 2025

Future updates will include additional features and enhancements to the Klaviyo API Addon.

Zoomed Image