How to add a Klaviyo signup form to your Shopify store manually
To install Klaviyo signup forms on your Shopify store, first, copy the signup form code snippet below and update “Public API Key” with your Klaviyo Public API Key. Then, paste the updated snippet into your store’s theme files.
This code block automatically populates line 3 with the Klaviyo public API key for the Klaviyo account you are currently logged in to. If you use multiple Klaviyo accounts, check that the correct public API key has been added to the code block. If you see “Public API Key”, then your public API key has not loaded, and you’ll have to manually update it. Copy your 6-character public API key from the Accounts > Settings > API Keys tab in your Klaviyo account.
1 2 | <script type="text/javascript" async src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=Public API Key"></script> |
After updating this snippet with your Klaviyo Public API key, paste it into the main theme file of your site, so that the code appears on every page. This allows you to trigger forms on any page on your store.
Next step, you need to verify your installation.
To verify that you have installed the form snippet correctly, visit the Signup Forms tab and click Install Code Snippet.
Here, you can enter your site URL and click Check my Install to confirm that klaviyo.js is set up correctly.
A red callout, on the other hand, will indicate that Klaviyo is unable to verify your installation. You should double check the instructions in guide. If your site isn’t live or is password-protected, Klaviyo won’t be able to verify your installation.
After verifying your installation, you can create a new form and publish it on your site.
After you’ve built and styled your form, when you click Publish, you’ll be prompted to verify your installation and add one line of code to your site.
Copy this code, then click Publish. Now, add the code to the theme files of your site where you’d like your form to appear. Your form won’t appear until you’ve added the code to your site and published your form.
The form is exactly where you want it. From here, you can use Klaviyo’s Signup Form Builder to edit the look and feel of the form going forward. Updates will be published automatically when we click Publish – no need to replace the embed code.