How to Set Up Klaviyo Pixel/Web Tracking via Google Tag Manager
Overview
If you would like to set up client-side tracking via Google Tag Manager, then you will 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 will also need to grab your Public API key from your Klaviyo account settings before downloading from your Elevar dashboard.
Prerequisites:
- Install Elevar's Data Layer and Shopify Source on your store. Follow this guide to learn how to implement the Shopify Source.
Note: Choosing the Right Tracking Method
Ensure you choose the appropriate method based on your store’s setup to accurately track events.
- Client-Side Tracking: Enable the Klaviyo app embed in Shopify.
- Server-Side Tracking: Enable the Elevar app embed. Read this guide to learn how to enable the Elevar app theme embed in Shopify.
If your store is headless, the Google Tag Manager (GTM) tags for Klaviyo are required. Read the following implementation guide to learn how to download and publish the required Klaviyo tags into GTM.
Download the Pre-Built Klaviyo Tags
Locate Klaviyo Container:
- Begin on the homepage of your Elevar app. Use the left-hand navigation menu and click on the tab titled "Pre-Build Tags".
- Use the search function to locate and click on the Klaviyo Pixel Container.
- (See Figure 1)
Figure 1
Download Klaviyo Container:
- Once in the Klaviyo Container, navigate to the box titled "Download Container".
- Click on the button labeled "Download Container".
- (See Figure 2)
Figure 2
Import the Pre-Built Klaviyo Tags into GTM
Import Container:
- Log in to your Google Tag Manager Account.
- Select your GTM Web Container.
- Click on the "Admin" button located in the upper menu bar.
- Use the right-hand menu under the "Container" section and click on the tab labeled "Import Container".
- (See Figure 3)
- Use the right-hand menu under the "Container" section and click on the tab labeled "Import Container".
Figure 3
Import Container Information:
- Under the "Select file to import" section, click on the "Select File" button and choose the Klaviyo Container that was previously downloaded.
- Under the "Choose workplace" section, either create a new workplace titled "Klaviyo Tracking" or select the "Default Tracking".
- Next be sure to select the "Merge" option first, then the "Overwrite conflicting tags, triggers, and variables" option second.
- Once you have completed filling out the necessary details for this container, click on the "Confirm" button located at the bottom of the page.
- (See Figure 4)
Figure 4
(Optional) QA the New Tags with Google Tag Manager's Preview Mode
- Follow our guide to QA your tags in Google Tag Manager (GTM) preview mode.
Publish the Pre-Built Tags
- After importing the Klaviyo tag container, you will be brought back to the Google Tag Manager homepage.
- In your workspace, click on the "Submit" button in the upper right hand corner of the page.
- An additional confirmation page will appear. Be sure to click on the "Publish" button in the upper right-hand corner of the page.
- (See Figure 5)
Figure 5
Updated about 5 hours ago