Identify your use case
While some data can be passed from the browser to Klaviyo, we strongly recommend tracking certain metrics server-side due to potential limitations of frontend code, security concerns, and general availability of data. For example, if a user has a slow internet connection or uses a JavaScript-blocking plugin, browser-based requests may fail to send, resulting in lost data. For critical metrics, like transactional events or events involving sensitive data, server-side API calls are the more secure and dependable option.
Walk through a server-side example
This video will walk through an example of using the server-side Events API with the Python SDK. Klaviyo offers additional SDKs in various languages like PHP, Ruby, and Node, with more languages coming in the future.
Helpful resources for server-side APIs
As you start using these APIs, use the API reference documentation available through the Developer Portal. These documents will give you all of the necessary code, and provide a testing tool that allows you to test examples in different languages.