Skip to content

Klaviyo Integration

Javascript Front Side

All customer facing pages load the script "//"


If a customer is logged in, or a potential customer has submitted a contact form message or completed the first step of the sign-up process and we have at least an email address, we identify the person:

    _learnq.push(['identify', {

                '$email' : '[email protected]',
                '$first_name' : 'test',
                '$last_name' : 'mcgee',


Started Checkout

After the first step of the sign up process when the customer has select a box, entered in their name, email, and address, we fire the 'Started Checkout' event:

_learnq.push(["track", "Started Checkout", {
     '$event_id': "1141260_1589562236",
     '$value': 47.95,
     "ItemNames": ["Only Organic Small Box Fruits & Veggies"],
     "CheckoutURL": "https://localhost/klcode/sign-up",
     "Categories": ["Boxes"],
     "Items": [{
         "ProductID": "705",
         "ProductName": "Only Organic Small Box Fruits & Veggies",
         "Quantity": 1,
         "ItemPrice": 47.95,
         "RowTotal": 47.95,
         "ProductURL": "https://localhost/klcode/shop/item/only-organic-small-box",
         "ImageURL": "",
         "ProductCategories": ["Boxes"]


Completed Signup

After the customer has signed up, when they land on the 'first-time' page, the event 'Completed Signup' is triggered, we update their schedule, sign up date, and status is set to Active.

_learnq.push(['identify', {
    'Schedule' : 'Weekly',
    'SignUpDate' : '2020-05-15 12:35:32',
    'Status' : 'Active',
    'HasFilledOutProfile' : true

var _learnq = _learnq || [];
  _learnq.push(['track', 'Completed Signup', {
    'Completed Signup' : true    



Cancelled Account

When an active customers decides to cancel their account, after they are prompted to confirm, their 'Status' is updated to 'Stopped', and we also trigger a 'Cancelled Account' event.

_learnq.push(['identify', {    
    'Status' : 'Stopped',    

var _learnq = _learnq || [];
  _learnq.push(['track', 'Cancelled Account', {
    'Cancellation Date' : '2020-05-15 12:40:28' 


Server Side

When performing an initial sync, we go to the very beginning of the system log to look for all the events that have happened in the past that we want to sync. Each event that is synced, if there is a customer attached to that event, will update the customer's schedule and status to what the CURRENT data displays.

Suppression List

Whenever the system sees the customer status is 'Dead' or that they are not subscribed to emails, regardless of the event we are processing, they are moved to the suppression list.

This check is also performed whenever we are updating Klaviyo with a Placed Order, Cancelled Order, or Fulfilled Order.

Log Parse

The first step the server side robots perform is to look for any events that we would like to have synced. We then create a queue of these events to actually send to Klaviyo at a later time.

For all events, we report the timestamp associated with the log entry to Klaviyo as when the event occured.

Note- Some of these events may result in duplicates now that the front side javascript is enabled and also tracks some of these events.

  • cancelled is when a log entry on customer account was found from when the customer cancelled their account. (A similar front side event is also tracked here)

  • contact.form is when the customer has submitted a message through the contact form.

  • failed.payment is when we attempt to automatically process a payment for the customer and the payment fails

  • is when the customer has received a credit to their account because of a referral

  • is when we send the customer an email containing their shipping information

  • started.signup is when the customer completes the first page of the sign-up process. This is identical and may result in duplicates with the front side: Started Checkout

Log Run

After the system has looked for new log entries to parse and add to our event queue, we run through our event queue and send each event to Klaviyo.

Process Orders

The final step of the server side Klaviyo integration is to send information about orders to Klaviyo.

Placed Order

When an order is created in the system, whether it's automatically on the customer's schedule, or for a new customer that signed up and had an order created before the cutoff, we fire off 'Placed Order'.

Cancelled Order

If the system sees that an order has been sent to Klaviyo as a "Placed Order", and now sees that the order status is 'Cancelled', we fire off "Cancelled Order" to Klaviyo.

Fulfilled Order

Once an order has been marked completed in the Kiva Logic system (after billing has successfully processed), and the order has already been sent to Klaviyo as a "Placed Order", we then send to Klaviyo that it is now a "Fulfilled Order".

Keep in mind this does NOT mean the customer has received the order. It means they have successfully paid for an order and it will be shipped to them that week. Currently, if billing runs on Friday, and an order ships on Tuesday, the customer might not receive their order until one full week after it was billed.

Possible Rulesets

If a Klaviyo contact has the event started.signup or "Started Checkout", but does NOT have a box, schedule, or a status of 'Active', then we know they can be considered a missed signup. Only when customers have completed the sign up process will they have a schedule, box, and a status of Active.