How To Implement Klaviyo Tracking with Shopify via GTM

Elevar powers your data layer and server-side tracking needed to connect Klaviyo and Shopify.

beginner Implementation Difficulty
How To Implement Klaviyo Tracking with Shopify via GTM

Integration Specs

  • Channel Accuracy Monitoring
  • Requires Elevar Data Layer
  • GTM server-side client customizable
  • Chrome Extension

  • GTM Web Container

What's Included

Events

What customer events are tracked in this integration

  • Product View
  • Add To Cart
  • Base Tag
  • Email Signup

Customer Parameters

What customer parameters are tracked in this integration

  • e-mail

Step 1: What To Consider

If you want to implement Klaviyo event tracking via Google Tag Manager please be sure you thoroughly test that all of your events and flows work properly.

Here is how a standard Klaviyo setup works:

  • App is installed on your store which in many cases automatically installs their base snippet (learn more about this step here)
  • You’ll hardcode a Product View tracking script into your theme
  • You may also add Add to Cart and/or out of stock events to your theme
  • Klaviyo app will automatically send started order and completed order events via their integration (so you usually don’t need to send these events separately)

The product view and add to carts events are then used for various flows like abandoned product views, etc.

If you’d like to move to GTM then you’ll need to import our Klaviyo pre-built container that includes the following tags:

  • Base snippet
  • Email signup (and sends email, if it exists in user session, to Klaviyo with the base tag)
  • Product view
  • Add to cart
  • Collection view

You’ll need to grab your Public API key from your Klaviyo account settings before downloading from your Elevar dashboard.

Image 2021-10-21 at 1.52.17 PM

If you plan on keeping your base Klaviyo installation, including the hard-coded product detail view script, then we don’t recommend adding GTM as well. These will duplicate and could lead to issues in your tracking.

If you decide to move forward with GTM then be sure you test thoroughly.

If you are browsing the site as a recognized user with Klaviyo then you can verify your events show up here:

Image 2021-10-21 at 1.47.17 PM

And then expand the details to confirm all of your product data is correct.

Have any questions on this integration?

Let us know at [email protected].

Step 2: Install Data Layer to Your Store

In order to deploy Klaviyo’s sitewide tracking via Google Tag Manager tags, you need to have a data layer implemented on your Shopify store that pushes customer and product data that Klaviyo’s tags require.

installdatalayer

If you don’t have a data layer for your Shopify store yet, then you can utilize Elevar’s data layer for Shopify. It’s a 1-click installation into your theme.

Step 3: Download Container for GTM

Inside of your Elevar account, go to Pre Built Tags > Klaviyo.

Update your Klaviyo Site ID key in the tag settings shown below.

klaviyo-gtm-shopify-tags

Download the container and save to your computer.

Step 4: Import Container to GTM

Next up, go to your Google Tag Manager container > Admin > Import.

import-container-gtm

Be sure to select Merge container, not overwrite.

Once you’ve imported, verify your Klaviyo Site ID variable is accurate.

Step 5: QA & Publish

Once you’re ready to go live then put GTM into preview mode.

You can navigate the site and view products & add to cart to verify your Klaviyo tags trigger as expected.

Remember that the data layer from step 2 needs to be live on your store in order for the variables – like product ID and product image – to work as expected.

If you are browsing the site as a recognized user with Klaviyo (e.g. you’ve opted into email with Klaviyo already or logged in) then you can verify your events show up here:

Image 2021-10-21 at 1.47.17 PM

And then expand the details to confirm all of your product data is correct.

Compatible Data Sources

Data layer

Complete data layer for Google Tag Manager including all native events and variables for Shopify.
Learn More

FAQs

View common integration questions