Skip to main content
Solved

Custom integration client side event not being sent

  • August 15, 2024
  • 2 replies
  • 67 views

Forum|alt.badge.img
  • Contributor I
  • 2 replies

We have NextJS app and we were able to integrate klaviyo and use it with the new object as per the docs. 

Events that are working: 

 - Active on Site

 - Viewed Product

 - Added to Cart

 - Started Checkout

 

Events that are NOT working: 

 - Placed Order

 - Ordered Product

 

All of the events are being executed from the client side!

Why `Placed Order` and `Ordered Product` are being executed from the client side?

Because there is no sensitive information in the data and in the klaviyo docs it is stated that it is RECOMENDED not MANDATORY. Server side events

 

E.g of the event: 

    window.klaviyo.push([

        'track',

        'Placed Order',

    {

        $value: orderData.total_with_discount,

        OrderID: orderData._id,

        OrderUserID: orderData.user_id,

        OrderDiscount: orderData.discount,

        OrderProductNames: currentItemNames,

        OrderItemCount: orderData.products.length,

        OrderCreatedAt: orderData.date_created

    }

]);

 

So, what would be the issue here?

Best answer by DavidV

Hi @Kirov,

Thank you for your question in the Klaviyo Community and thank you for the tag @stephen.trumble!

The Klaviyo Client Side Javascript API is only used for tracking on-site behaviour prior to data being submitted to the actual server itself. This means that in a typical integration you connect Active on Site, Viewed Product, Added to Cart & Started Checkout.

Typically events such as placed order include a lot more PII data including address details, line items etc so Klaviyo require you to use a private API key that is permitted to send this data in.

This page has a lot more information about the best way to build out a typical eCommerce integration into Klaviyo.

I hope that helps - feel free to post any questions here in the Developer Community! 

Thanks
David 

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

2 replies

stephen.trumble
Community Manager
Forum|alt.badge.img+60

Hey @Kirov 

Thanks for reaching out for help with your custom integration. Unfortunately Klaviyo cannot offer support with custom integrations. However, I have moved this question into the Developer Group as they are the experts when it comes to any dev related questions. @DavidV, would you be able to help?


DavidV
Partner - Platinum
Forum|alt.badge.img+30
  • 2025 Champion
  • 208 replies
  • Answer
  • August 26, 2024

Hi @Kirov,

Thank you for your question in the Klaviyo Community and thank you for the tag @stephen.trumble!

The Klaviyo Client Side Javascript API is only used for tracking on-site behaviour prior to data being submitted to the actual server itself. This means that in a typical integration you connect Active on Site, Viewed Product, Added to Cart & Started Checkout.

Typically events such as placed order include a lot more PII data including address details, line items etc so Klaviyo require you to use a private API key that is permitted to send this data in.

This page has a lot more information about the best way to build out a typical eCommerce integration into Klaviyo.

I hope that helps - feel free to post any questions here in the Developer Community! 

Thanks
David