Skip to main content
Contributor I
August 15, 2024
Solved

Custom integration client side event not being sent

  • August 15, 2024
  • 2 replies
  • 211 views

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?

    This topic has been closed for replies.
    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 

    2 replies

    stephen.trumble
    Klaviyo Alum
    August 22, 2024

    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?

    -Stephen
    DavidV
    Partner - Platinum
    DavidVAnswer
    2025 Champion
    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 

    Zyber is New Zealand's leading Shopify Premier & Klaviyo Master Platinum Partner passionate about helping merchants succeed. www.zyber.co.nz & www.unlocked.co.nz