gatsby klaviyo

  • 29 December 2021
  • 1 reply


how can i add javascript api to the frontend(gatsby website) ?

im trying to integrate my custom website with klaviyo and i am not able to integrate it using the javascript api. it does not recognize the learnq object. Any idea where should i add the script in react application to fire it up.


Best answer by David To 29 December 2021, 19:45

View original

1 reply

Userlevel 6
Badge +43

Hello @usamaamjad,

Thanks for sharing your question with the Klaviyo Community!

From my experience, the learnq object not being recognized typically occurs if the script is not loaded in the right order or if the script isn’t loaded at all which can be caused by a wide variety of possibilities - especially with a custom website/setup. It may also be a good idea to start with verifying that the learnq object can be invoked in the DOM. I would further suggest working with a developer you are familiar with or speaking with one of our accredited Klaviyo Partners who can assist with your custom setup. 

In addition, if you haven’t already, it may help to take a look at some of the Guides and API References available within our Developer’s Portal. Since you’re looking to connect a custom site to Klaviyo, the Integrate a Platform Without a Pre-built Klaviyo Integration and Custom Integration FAQs Guides are a great place to get you start!

I hope this helps!