Using Klaviyo Forms with Lead Pages

If you are running an ecommerce store then Klaviyo is a must for your email marketing.  With very little work you should be able to create a targeted offer to your existing buyers that pays for many months of their service.

However, if you are doing any lead generating you’ll find that their forms use some javascript that creates a problem for services like LeadPages where you normally just paste the HTML optin code.  Until Klaviyo is natively integrated in to Leadpages (like it is with OptiMonk) then you can use this little script to make the magic happen.

You’ll want to install a copy of this script for each list and thank you page that you have setup.  Using your FTP server upload it your site with a name that ends in .php

Instructions:

  1. Line 4 – get your API key from https://www.klaviyo.com/account#api-keys-tab.  Create one and name it to something you will remember.
  2. Line 5 – get your Klaviyo list ID by clicking the List settings on the list you want people to be added to.   It will be about 6 characters long and can also be found in the URL: https://www.klaviyo.com/list/mL4Ktx/settings for example
  3. Line 6 – set the thank you page that you want to deliver people to after they optin.  Make sure it is a valid URL with the HTTP:// added to the front.
  4. Final step – in your leadpages form paste the code below.  Just change the URL for where you installed the script above.  You can delete the firstname section if you are just capturing the email address.


How it works – Basically the email is submitted to this script which then adds it to Klaviyo via the API.

If you need help with scripts like this I’d highly recommend reaching out to Norio De Sousa (TechAssassin.co) who originally created this script for me.

11 Comments

  1. Justin on March 26, 2016 at 12:45 am

    Any solution for integrating klaviyo with leadpages, specifically for a store on Shopify?

    • Jessie M on January 2, 2017 at 8:39 pm

      Would also like to know how to use these in Shopify! Bump.

  2. Geoff on June 30, 2016 at 7:07 am

    Thank you, Darren

    This blog is a fantastic resource, Thank you! However, I recommend you make one change. I had to use a private Klaviyo API Key rather than the six digit public one you describe. Not sure if that was something that the Nepali Developer I used did due to an error on his behalf or whether your documentation requires an update? (And no I did the private API Key myself so he does not have access to it!)

    PS: How would I go about making this a secure form?

    Cheers
    Geoff

    • Darren Crawford on July 1, 2016 at 10:24 am

      This could be a recent change/upgrade on Klaviyo’s end.

  3. Erik on August 15, 2016 at 1:54 am

    Hi Darren, great workaround, worked perfectly and I actually implemented it into OptimzePress + Klaviyo.

    Do you know how could I include Last Name in the scripts as well or is this something I’d need to reach out to Norio?

    Cheers,
    Erik

  4. phil on January 2, 2017 at 3:59 pm

    Any solution for integrating klaviyo with leadpages, specifically for a store on Shopify?

  5. Daniel on April 5, 2017 at 7:00 pm

    Hey Darren,
    I apparently costs $1,800 to have Norio implement this…

    I’m having a hard time figuring out where to place the code “in the leadpage form” on my WP’s site according to step 4.
    Am I looking for the form on my websites server or is it done from the backend of leadpages somehow?

    Hoping to be able to make this work myself.
    Just a little stuck.

    Thanks!

    • Darren Crawford on April 6, 2017 at 7:38 pm

      The code from step 4 would be pasted in the HTML form option of leadpages. But… if you use OptinMonster it has a direct integration to Klaviyo.

  6. Kelly Payne on April 7, 2017 at 1:54 pm

    Darren, can you expand on this: “You’ll want to install a copy of this script for each list and thank you page that you have setup. Using your FTP server upload it your site with a name that ends in .php” I’m using a WP site and don’t really want to mess with the FTP server. If I’m installing a copy for each list, wouldn’t that need to go into Klaviyo somewhere. Regarding the thank you pages, I guess i just insert the code in the header or footer? Any help you can provide would be much appreciated…

Leave a Comment