You will learn
Learn how to use the Klaviyo Connector with Shopify Flow to track events (to send data from your workflow to Klaviyo) and create campaigns (to send via Klaviyo).
Before you beginBefore you begin
Knowledge check
If you have not already, read our guide on getting started with Shopify for step-by-step instructions on integrating, before continuing with this article.
What is Shopify Flow?
Shopify Flow is an ecommerce automation platform that Shopify stores can use to automate common tasks, such as:
- Tagging high-value customers
- Flagging and cancelling high-risk orders
- Sending reordering requests when your inventory levels become low
- Identifying and adding tags to products based on their title or SKU
Shopify Flow is an app offered by Shopify in their App Store and is available for those on the Shopify plan and up (it is not available for those on the Basic plan). You can access the app in Shopify's app store and should install it before following the steps in this article.
For Shopify merchants using Flow, there are a number of resources available for understanding what's possible with Flow, and workflows you can download and import into your store:
What can I do with Klaviyo Connector for Shopify Flow?What can I do with Klaviyo Connector for Shopify Flow?
Shopify Connectors is a feature that allows Shopify stores to create app triggers and actions that third-party partners have built.
The Klaviyo Connector supports two actions:
-
Track an event
This action sends data from your workflow to Klaviyo for it to track.-
Example workflow
When a customer's loyalty tier changes, you can track this change in Klaviyo. -
How it works
- This workflow is triggered by LoyaltyLion when a customer moves up a loyalty tier. LoyaltyLion send the tier information to Shopify Flow.
- Shopify Flow sends data about the customer to Klaviyo, to track the event, and to LoyaltyLion, to add bonus points the customer's loyalty account.
-
Example workflow
-
Create a campaign
This creates and sends a campaign via your Klaviyo account using a specified list or segment and email template.-
Example workflow
When you use Shopify’s Launchpad app to plan a sale and execute a theme change for your Shopify store, you can schedule a marketing email to coincide with your theme change using Shopify Flows. -
How it works
- Configure your Klaviyo email template with details of your theme change.
- Use the ID for your desired list or segment to create the campaign within Shopify Flows.
-
Example workflow
How to use the Klaviyo Connector
In a Shopify Flow, you can add actions into a workflow.
- When in the Select an action menu, you can choose from Standard Actions developed by Shopify or additional actions developed by third-party apps. This is where you'll find the Klaviyo Connector if it's installed.
- The two actions available in the Klaviyo Connector are Track an event and Create a campaign.
Track an event
Once you choose the Track an Event action, you'll need to fill out the following fields:
-
Klaviyo Public API Key
Learn how to locate your public API key in Klaviyo. -
Event Name
Name of the event you want to track. This will appear on the customer profile's event timeline. -
Customer Email Address
Email of the person going through the Flow whose activity will be tracked in Klaviyo. -
Customer First Name
First name of the person going through the Flow whose activity will be tracked in Klaviyo. -
Customer Last Name
Last name of the person going through the Flow whose activity will be tracked in Klaviyo. -
Customer Properties
Hash dictionary of customer properties to be included in their Klaviyo profile as a custom field.
-
Event Properties
Hash dictionary of custom information about this event.
It is important to note that anything sent as a list, such as customer or event properties, will need to be formatted as a JSON list to appear properly in Klaviyo. For example, you could format customer tags in the following way: {"tags": [{% for tags_item in customer.tags %}{% if forloop.first != true %},{% endif %}{{ tags_item | json}}{% endfor %}]}
These events will be tracked in Klaviyo as Shopify events, as indicated by the Shopify icon alongside each event. To view your Shopify Flow event data:
- Click the Analytics dropdown in Klaviyo and select Metrics
- Select Shopify from the dropdown menu. The tab will display only the events synced from Shopify.
Create a campaign
Once you choose the Create a Campaign action, you will need to fill out the following fields:
-
Private API Key
Learn how to locate your private API key in Klaviyo. If you do not have one associated with your account yet, you may create one on this page. Your private API key should always be kept secret and should not be shared. -
List or Segment ID
Click the Audience dropdown in Klaviyo and select Lists & Segments. Click on your chosen list or segment, select the Settings tab, then copy the six-character code displayed here and enter it into the corresponding field. -
Template ID
Click the Content dropdown in Klaviyo and select Templates. Click into your preferred email template, then copy the six-character code from the URL (the template ID) and enter it into the corresponding field. -
Sender Email Address
The email address that your recipients will see. -
Sender Name
The name that your recipients will see. -
Subject
The email subject line that will be used for your campaign. -
Campaign Name
Your campaign’s name. After sending, you will be able to find and observe performance for your campaign in your Klaviyo account. -
Enable Smart Sending? (Optional)
Enabling Smart Sending will skip recipients who have recently received an email from you. -
Use UTM Tracking? (Optional)
Links in this campaign will include additional tracking information (UTM parameters) in third-party reporting tools like Google Analytics.
Troubleshooting
Is your data not showing in Klaviyo as expected?Is your data not showing in Klaviyo as expected?
Make sure that the Customer Properties box and the Event Properties box are valid JSON. If the input is not valid JSON, the Track an Event step will not pass data into Klaviyo as expected. For example, your data variables may include for-loop statements. When the for-loop statements are evaluated, they might leave trailing spaces due to the new line that the variables exist on within the for-loop syntax:
"{% for lineItems_item in order.lineItems %}
{{lineItems_item.name}}
{% endfor %}"
This will not be ingested by Klaviyo due to it being invalid JSON. To resolve, remove the line breaks in between the syntax of the for-loop like this:
"{% for lineItems_item in order.lineItems %}{{lineItems_item.name}}{% endfor %}"
OutcomeOutcome
You've now learned how to use the Klaviyo Connector with Shopify Flow to track events and create campaigns.
Additional resourcesAdditional resources
- Getting started with Shopify
- Learn more about Connectors on the Shopify Help Center