Skip to main content
106 Topics
Help Center

How to personalize onsite content with Klaviyo’s group membership API

You will learn Learn how to use the klaviyo JavaScript object’s getGroupMembership method, which can be used to implement onsite personalization on your website. This requires loading the klaviyo object and passing an array of lists or segments to check, which will return an output that you can leverage for onsite personalization. Advanced KDP is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our billing guide to learn how to purchase this plan. Before you begin This feature is only available for Advanced KDP customers, and is only available through the klaviyo object. To learn more about the klaviyo JavaScript object and what it can do, read the introduction to the Klaviyo object. When you add Klaviyo's onsite tracking to your site, only the browsing activity of "known browsers" is tracked (i.e. browsers that have visited, engaged, and been identified or "cookied"). Klaviyo’s onsite tracking does not track anonymous browsers. There are 3 key ways Klaviyo will identify a site visitor for onsite tracking: If someone has clicked through a Klaviyo email to your website. If someone has subscribed through a Klaviyo form. If someone has logged into your site and you have tracking installed. Install Klaviyo.js and load the Klaviyo object You’ll first need to install Klaviyo.js, if you have not done so already. Klaviyo.js, also known as Klaviyo’s “Active on Site” JavaScript, automatically supports the klaviyo object. If you have enabled an integration with your Klaviyo account or installed Klaviyo.js manually, you will be able to initiate the klaviyo object to listen for relevant calls. To use the klaviyo object immediately on page load, we recommend manually installing the snippet below on your site (in addition to installing Klaviyo.js as mentioned above). The klaviyo object only needs to be loaded once per page. To load the klaviyo object: !(function () { if (!window.klaviyo) { window._klOnsite = window._klOnsite || []; try { window.klaviyo = new Proxy( {}, { get: function (n, i) { return "push" === i ? function () { var n; (n = window._klOnsite).push.apply(n, arguments); } : function () { for ( var n = arguments.length, o = new Array(n), w = 0; w < n; w++ ) o[w] = arguments[w]; var t = "function" == typeof o[o.length - 1] ? o.pop() : void 0, e = new Promise(function (n) { window._klOnsite.push( [i].concat(o, [ function (i) { t && t(i), n(i); }, ]), ); }); return e; }; }, }, ); } catch (n) { (window.klaviyo = window.klaviyo || []), (window.klaviyo.push = function () { var n; (n = window._klOnsite).push.apply(n, arguments); }); } } })(); To use the klaviyo JavaScript object’s getGroupMembership method for onsite personalization: Within your code, select the list or segment IDs you want to check membership for. The limit is 50 lists or segments. Identify users on your site via a Klaviyo form or other means. Make a call in the following format, with an array of the list or segment IDs you want to check membership for: klaviyo.getGroupMembership(['listID1', 'listID2', 'listID3']) The output provided will be an array of the list/segment IDs that the identified user belongs to, given that those IDs were in the input array. If an empty array is returned, it means that you passed in too many IDs, or that the user does not belong to any of the lists or segments you provided. You can use the returned segment and list membership data to customize your site with relevant products, content, and more based on customer segments from Klaviyo. Code example Here is an example showing how to call the getGroupMembership API with multiple segment IDs. const customerSegments = await klaviyo.getGroupMembership([ VIPSegmentID, UnEngagedSegmentID, DogLoversSegmentID, ]); Impact on site performance The group membership API has minimal impact on your site's performance. The Javascript file (i.e., web_personalization.js) Klaviyo loads on your site is only about 1.2KB and the bundle request for this file is not main thread blocking, so it does not impact the usability of any pages. The data that is loaded to customize a site based on the customer profile is cached in the browser after it is first requested, so additional requests do not require backend API calls. Outcome You can now use the klaviyo JavaScript object with web per

Help Center

How to build a back in stock flow

You will learn Learn how to build a Klaviyo back in stock flow to alert customers about inventory if you are using the Shopify, BigCommerce, Magento 2, PrestaShop, SFCC, or Shopware platforms, or if you have an inventory-aware catalog synced via custom catalog feed or API. The Back in Stock feature has 2 key components: Back in Stock FlowWhen someone subscribes to a restock alert, a Subscribed to Back in Stock event will be tracked on their Klaviyo profile. This is the event you will use to trigger your back in stock flow. Shoppers will enter the flow when they subscribe to a restock alert and wait at a back in stock delay until their item of interest is restocked. Website ButtonOnce your flow is ready and waiting, add the back in stock snippet to your store's theme files. This snippet will automatically show a "notify me when available" button when items become sold out. When shoppers click this button, they'll fill out a form and go right into your flow. Instructions for specific platforms are below: Shopify BigCommerce Magento 2 PrestaShop  SFCC Shopware Custom catalog feeds API Custom metrics cannot be used to trigger a back in stock flow. Only the Klaviyo-specific metric used with one of the listed integrations, a custom catalog, or a back in stock subscription API call can trigger a back in stock flow. Keep in mind that if you're using Shopify's point-of-sale (POS) hardware and an ecommerce store, the back in stock flow will count all of the inventory in your physical store as well as in your warehouse. Flow best practices There are a couple best practices to keep in mind when using flows: Start with pre-built flows from the flows library for templates that implement best practices. Keep the flow between 1 to 3 messages to not overload your subscribers. Optimize your sending frequency to ensure customers have enough time to check their email. Turn on Smart Sending for non-essential messages. If you haven't done so, set up these flows to maximize conversions from your subscribers: Welcome series Abandoned cart Browse abandonment Winback Review request Post-purchase Set up a back in stock flow Klaviyo has pre-built back in stock flows available in the flows library. Navigate to the Flows tab. Choose Create flow. You can find all loyalty and sales-oriented flows we offer by filtering your view by the following goal: "Remind people to purchase." You can also easily find these available Back in Stock flows by searching for "back in stock" in the toolbar at the top of the flows library. After populating any flow in your account from the library, we recommend reviewing all email content and updating the templates to match your brand. If you'd like to build a back in stock flow from scratch, you can do this as well. 1. Click Create flow &gt; Build your own. 2. Once in the flow builder trigger selection, select Your metrics. Choose the Klaviyo-branded metric Subscribed to Back in Stock. Do not add any trigger or flow filters, and click Save. 3. The next component you'll want to drag in — directly after the trigger — is the Back in stock delay. Recipients that enter your flow will wait at this delay until their item of interest is restocked. After this occurs, they will move on to the next step in your flow (which is typically an email but could be an SMS). 4. Typically, you will only need a single message in this flow as a notification that the item is back. Make sure to turn Smart Sending off for this message to ensure everyone gets the alert.  You do not need to add any time delays components to this series, as the back in stock delay will ensure each person that enters your flow waits until the item they subscribed to goes back in stock before moving forward. Back in stock flow settings There are 2 key settings you can adjust regarding your back in stock flow: Minimum inventory rules Customer notification rules These can be configured in your Account's settings and work for both email and SMS. Select your account name in the lower left, then click Settings &gt; Other &gt; Back in stock settings.  Minimum inventory rules Minimum inventory rules refer to how many items need to be restocked before you notify those who subscribed. Depending on how you handle restocking when inventory runs out, you may only receive a few products in for a given SKU or variant at a time. If this is the case, you may prefer to have a threshold at which you consider the volume significant enough to let people know the item is back in stock. Notification strategy rules Notification strategy rules have 2 sub-settings that work together to customize how many and how frequently to send back in stock messages. These settings allow you to send restock notifications all at once or in batches. The 2 components that you can configure are: Customers to notifyThis determines how many customers are notified when an item is restocked. If you have a high-demand item, you might receive hundreds of subscriptions when it goes

Help Center

Understand the different webhooks available in Klaviyo

You will learn  Learn about the differences between webhook solutions available in Klaviyo, and when you should use each one.  Before you begin Advanced KDP is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our billing guide to learn how to purchase this plan. What are webhooks? Webhooks allow Klaviyo to pass information or “call” other applications, tools, and servers via HTTP requests. They can send information about an event that has happened (e.g. an order placed, a new customer subscribed, etc) or notify your external systems that the event has occurred. Webhooks are made of a few key components: TopicThe event that causes a webhook to fire. Body (or “the payload”)The data that the webhook sends. HeadersA place to pass additional information (such as authentication). Flow webhooks You can add webhooks in flows as an action that occurs when the flow reaches a certain stage or step. Once a flow reaches the webhook action, a POST request is sent with data about the event or the recipient that triggered the flow, based on how you construct the payload.  Flow webhooks can only send based on flow-triggered events (i.e., events that can be used as a flow trigger). Additionally, flow webhooks do not support message-related events (e.g., Received email, Clicked email, Marked email as spam) as flows typically end in message receipt.  Unsubscribed from Email Marketing can be used as a flow trigger and the topic for a flow webhook.  Example use cases for flow webhooks Some example uses case where flow webhooks would be most effective include: Send a message or POST request that triggers based on a subscriber being added to a segment or list. Automate suppressions when a profile enters an unengaged segment.  Send a personalized thank you message through a service like Whatsapp or Facebook messenger when customers purchase.  Webhooks in Advanced KDP  Advanced KDP is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our billing guide to learn more about adding this functionality to your plan or get started if you are a new customer. Webhooks in Advanced KDP allow you to notify external systems in response to events, without depending on a series of steps leading up the webhook action. Advanced KDP webhooks do not require you to manually construct or specify the body of the webhook request. If you want to notify your external systems that an event has occurred without any custom development, webhooks in Advanced KDP are most effective.  Advanced KDP webhooks also support a wider range of topics to trigger the request, and allow you to send information in response to any event that can be queried for via the Get Events API.These include: Email events (e.g., Received email, Clicked email, Marked email as spam) SMS events (e.g., Sent SMS, Received SMS) Push notification events (e.g., Received push, Bounced push) Events from integrations ( i.e., events from first-party integrations created by Klaviyo) API events (e.g., events synced through Klaviyo’s APIs) This includes message-related events like Unsubscribed, Received email, or Clicked email that are not supported by flow webhooks. Additionally, Advanced KDP webhooks allow you to subscribe to multiple triggers at once, unlike flow webhooks, which depend on single-trigger flows. Destination URLs must be publicly accessible HTTP endpoints.  Example use cases for Advanced KDP webhooks Sync customers’ Unsubscribed events to external systems. Report Received Email events to help desk software so agents can see email history to better serve customers. Sync all email sends, opens, and clicks into a data warehouse that is not supported by Klaviyo's data warehouse sync. Code  Code is a feature included in Klaviyo Advanced KDP. It is not included in Klaviyo’s standard marketing application, and a Advanced KDP subscription is required to access the associated functionality. Head to our billing guide to learn more about adding this functionality to your plan or get started if you are a new customer. Code leverages webhooks to enable the execution of custom functions in response to an event trigger. You can write code directly in Klaviyo’s editor, and Klaviyo manages the code execution, monitoring, and logging. If you want to send requests to your external systems without hosting a public HTTP endpoint, you can use Code. Additionally, if you want to execute custom functions in response to an event occurring, you should use Code rather than the other webhook solutions available in Klaviyo.  Code also supports more granularity with event triggers over webhooks in Advanced KDP. You can select individual metrics to act as the topic rather than all integration or API events. Note that Code does not support the following events as topics:  Email opened Email received Example Code use cases 

Help Center

Understanding list bombing and how to remove fake profiles

You will learn  Learn about list bombing attacks and how you can remove fake email addresses to protect your lists. List bombing attacks fill your account with fake profiles, and can harm your sender reputation, data, and more.  What is list bombing? List bombing is a malicious attack where the attacker exploits a signup form or checkout page by making a large number of fake submissions, filling the associated list with emails and phone numbers that have not consented or are invalid. While an increase in email subscribers may initially seem like a good thing for your brand, this is only true if all the new leads are legitimate. If you send to fake profiles created through a list bombing attack, it can negatively impact your deliverability in the following ways:  Higher hard bounce rates Higher spam complaints Lower open rates Negative impact to sender reputation Potential spam trap hits  Potential blocklisting resulting in blocked email traffic Not all profiles submitted as part of a list bombing attack are fake email addresses. Bots can fill out forms with real email addresses, and profiles of people who have no knowledge of this are being added to marketing lists. When a company sends emails to mass amounts of profiles submitted by bots, many of them mark the email as spam.  These are a few of the most commonly targeted forms that bots target. Keep in mind this is not an all inclusive list; bots can submit profiles anywhere there is an unprotected form: Ecommerce checkoutsBots have been observed, especially for customers using an ecommerce platform (such as Shopify). The bots can start a checkout and abandon it using a real person’s email, and the event will sync to Klaviyo. Home page footer formFooter forms on a home page that collects email addresses and no other information has been a specific target of bots to sign up emails. Coupon codes (“$$OFF”, or “%OFF”) on the home pageBots target these forms specifically to get coupon codes which they later put on coupon / promo code websites to drive website visits to those pages. Forms without captchaForms without captchas are susceptible to bots filling them out. APIBots submitted by 3rd party forms and synced to Klaviyo through our public API. How to identify a list bombing attack  The first indicator of list bombing is if you've experienced a sudden spike in new subscribers. This is particularly true if you haven't planned any list growth campaigns, so there is nothing to tie this spike to. If this happens, examine the recent email subscribers, looking out for the following trends:  The emails all came in through a single point of entry (e.g., same signup form) There was a specific timeframe in which the influx of emails was captured  All the emails are from the same domain (e.g., all are from @phish.com) The contacts have unconventional first and last names All submissions are from the same IP source How do you protect against list bombing? CAPTCHA in forms CAPTCHA is a tool that requires form submitters to complete a short task to verify that they are a real person and not a bot. When Klaviyo detects suspicious behavior or historical bot activity from a user’s IP address, they will be prompted to solve a CAPTCHA. This functionality is automatically enabled for forms that collect email or SMS leads, or utilize a coupon code. Additionally, only users that have had suspicious activity will be prompted to complete the CAPTCHA.  The user must successfully complete the CAPTCHA in order to see their coupon code and submit the form.  Double opt-in  Double opt-in is a process through which a new subscriber must confirm their subscription before being subscribed to a given list. It is the same for both email and SMS subscribers, and is on by default in Klaviyo. When double opt-in is enabled, new subscribers will receive a confirmation message immediately after signing up. This message will prompt them to confirm their subscription. Only subscribers who confirm their subscription will be successfully added to the list, making it harder for malicious actors to list bomb.  List bombing IP management Klaviyo has a system in place to prevent list bombing called the List Bombing IP Management. The purpose of this system is to flag or block specific IP addresses that are making a large number of form submissions or subscribe API calls within a short period of time. If you are being list bombed, this system would block IP addresses with a large number of initial subscribe requests to protect your account from further profile subscriptions.  Note that the IP blocking only occurs after the attack has already started to protect your account from further harm. This method of list bombing mitigation cannot prevent an attack entirely. Honeypot form field This method requires a developer and access to the form’s HTML. If your forms are built through Klaviyo’s form editor, consider creating a custom form. Adding a “honeypot” field to a website’s form is a method y

Help Center

How to integrate with Funraise

You will learn Learn how to integrate Funraise with Klaviyo in order to personalize and target emails based on each contributor's donation and website activity. The data synced from Funraise to Klaviyo includes: When a contribution is made Contribution amount Customer information including first and last name, location, and how they found your site Whether the donation is recurring and if so, how often it will occur Whether the contributor wants to be anonymous Add the Funraise integration In Klaviyo, select your account name in the lower left and click Integrations.  Click Add integrations, search for Funraise, and click the card. Then, click Install. Enter your username and password, then click Connect to Funraise. Note that the Email and Password must have admin access, otherwise, Klaviyo will not pull in all of your fundraising and campaign data. On the next page, you will have the option to automatically add new supporters to a Klaviyo list, and select a list from the dropdown. Click Complete setup. Add Klaviyo onsite tracking Klaviyo provides different types of onsite tracking, one of which tracks when known users are active on your site. This type of tracking is known as Active on Site tracking, and you can enable it for your Funraise site. To enable it, you must add a code snippet to your site footer.  With Active on Site tracking, you’ll be able to see and leverage data related to website visits and visitor behavior. For example, you can use the Active on Site metric to create segments of people who have visited your site (while logged in), but haven't yet made a donation.  Copy the Active on Site code snippet below: &lt;script type="application/javascript" async src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=Public API Key"&gt;&lt;/script&gt; Navigate to your Funraise site and paste the snippet into the main template of your app before the &lt;/body&gt; tag. Replace the ‘Public API Key’ text in the snippet with your Klaviyo public API key, found in your Klaviyo account under Account name &gt; Settings &gt; API keys. Save your changes. In your Klaviyo account, navigate to Account name &gt; Integrations &gt; Manage sources &gt; Setup web tracking in the upper right, and enter your site URL on the second step. Click Next to test your tracking setup.      If your tracking was set up correctly, you will receive a success message. Monitor the Klaviyo sync &amp; verify donation data To monitor and verify your Funraise integration data sync: Click the Analytics dropdown in Klaviyo and select Metrics. Search for and click on the Made Contribution metric to verify that there is data populated for the metric. If there is data, all you need to do is wait until your initial Funraise integration sync has completed; this process can take up to a couple hours depending on how much data you have in your account. Klaviyo will import all of your historic Funraise data; to verify this, you can compare the number of contributions on a particular day in Klaviyo with what's in your Funraise interface and confirm they match. If they don't match, the issue is most likely that your Klaviyo account's timezone doesn't match your Funraise timezone. To check your timezone setting in Klaviyo, click your account name in the lower left, select Settings &gt; Organization. Locate the Time zone section. Data synced from Funraise There is one major metric that is captured by Funraise and synced Klaviyo: Made Contribution. This event is tracked when a supporter makes a contribution in Funraise. The event Klaviyo tracks includes all of the information Funraise collects including the contribution amount, whether the donation is recurring, and if so, how often the donation will recur. You can filter and target Made Contribution events based on the following key criteria: Donation Type Form Name Form URL Is Anonymous (True or False) Is Dedication (True or False) Is Recurring (True of False) Page URL Here is an example of all the data Klaviyo receives along with a Made Contribution event: In addition to this core metric Klaviyo syncs from Funraise, Klaviyo also creates a Klaviyo profile for every contributor. Along with basic contact information, Klaviyo will also sync any additional details you might have stored in Funraise about a given person. These details will sync as custom properties that get added to each Klaviyo profile. You can use these properties in segments and flows. Here are the default properties that are automatically synced from Funraise: Email First Name Last Name City State/Region Zip Code, Country Phone Number Outcome You have completed integrating with Funraise, set up web tracking, and have verified your Funraise data in Klaviyo. Now, you'll be able to personalize and target emails based on each contributor's donation and website activity.  Additional resources Integration FAQ reference  How often integrations sync reference