Skip to main content
Solved

Custom API/Tracking Setup Question

  • August 25, 2022
  • 1 reply
  • 125 views

Forum|alt.badge.img+2

Hi!

We don’t have a direct integration between our website/ecommerce provider and Klaviyo, and are looking into setting it up manually. I’ve read a couple of articles on the API options and steps, but have a couple of questions.

1) I believe these two articles mention the same Javascript Active on Site but the code is just slightly different. Is there a reason? Should I use the first?

2) We select either the javascript OR the server side Track API to implement, right? If so, it seems that the server-side would be preferential because it tracks more information...

There are likely obvious answers to these, but I’m not a developer…. so I appreciate any guidance or insight!

EDIT TO ADD: I just found another article on javascript/API implementation, ha ha! Any advice on which of the articles to follow and reference? 

https://developers.klaviyo.com/en/docs/javascript-api

Thank you,
Bethany

Best answer by David To

Hello @mediadirector,

Welcome to the Klaviyo Community!

Appreciate you highlighting that discrepancy in those Help Center articles and guides! Although there is actually no harm in using either one of those snippets, I would rather suggest using the <script type="text/javascript" async="" src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=API_KEY"></script> one found in the Guide to Klaviyo Onsite Tracking Help Center article. Essentially using the Application/javascript is just an outdated method of calling text/javascript. 

Selecting to use either javascript or a server side track API call would depend entirely on what it is you were trying to do. For example, it’s typical that you’ll use javacsript to track events such as viewed product, added to cart, started checkout, etc. while leveraging server-side to track transactional based events such as placed order, fulfilled order, cancelled order, etc. Overall, it would depend entirely on the events you want to track, including the types of custom events you may want to track as well!

We also have an expansive network of Klaviyo Partners who specialize in development work and API assistance which you can find through our Klaviyo Partner Directory if you need more hands on assistance too. 

Thanks for bringing that discrepancy to our attention!

David

View original
Did this topic or the replies in the thread help you find an answer to your question?

1 reply

David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • Answer
  • August 26, 2022

Hello @mediadirector,

Welcome to the Klaviyo Community!

Appreciate you highlighting that discrepancy in those Help Center articles and guides! Although there is actually no harm in using either one of those snippets, I would rather suggest using the <script type="text/javascript" async="" src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=API_KEY"></script> one found in the Guide to Klaviyo Onsite Tracking Help Center article. Essentially using the Application/javascript is just an outdated method of calling text/javascript. 

Selecting to use either javascript or a server side track API call would depend entirely on what it is you were trying to do. For example, it’s typical that you’ll use javacsript to track events such as viewed product, added to cart, started checkout, etc. while leveraging server-side to track transactional based events such as placed order, fulfilled order, cancelled order, etc. Overall, it would depend entirely on the events you want to track, including the types of custom events you may want to track as well!

We also have an expansive network of Klaviyo Partners who specialize in development work and API assistance which you can find through our Klaviyo Partner Directory if you need more hands on assistance too. 

Thanks for bringing that discrepancy to our attention!

David