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

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

System Compatibility

  • Compatible with Magento 2.3.x - 2.4.7
  • 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.7 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.

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.10.1 April 7, 2025

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

Zoomed Image