In which of the following cases would you use a client-side API?
- To retrieve all of the lists that a profile is subscribed to
- To log a user’s site browsing activity on their Klaviyo profile
- To create a Placed Order event when a customer places an order on your site
Explanation: The choice between a client-side and server-side API in Klaviyo depends primarily on where the data is coming from and how secure that data needs to be. Front-End Interaction: Client-side APIs (like klaviyo.js) are designed to run in the user’s browser. This makes them perfect for tracking real-time onsite behavior—such as Active on Site, Viewed Product, or Clicked Banner—because the code can easily “see” what the user is doing on the page. Public Authentication: These calls use your Public API Key (or Site ID). Since this key is visible in your website’s source code, it is restricted to low-sensitivity actions. You wouldn’t want to use it for sensitive data, but it’s ideal for high-volume, behavioral tracking. Real-Time Identification: Client-side tracking allows Klaviyo to instantly associate a browser’s “anonymous” cookies with a specific profile once they identify themselves (e.g., by clicking an email link or filling out a form).