Solved

What is cookied and how does the item removed after checkout

  • 10 August 2021
  • 6 replies
  • 206 views

Badge +2

Hi All,

 

I’m creating a custom flow for our website which is developed using Laravel. I have successfully created server side Track & Identity API for successful order and fulfilled order.

 

Now im trying to implement the track in frontend store, when i check the documentation its saying we can track if the user is COOKIED. What exactly cookied here stands for and how does the API track the users.

 

And i saw the JS API for item added to cart and started checkout, so what happens if the checkout is completed? how to pass the information to Klaviyo so that the checkout/added-to-cart item is removed/reset.

 

P.S : I’m following this URL : https://help.klaviyo.com/hc/en-us/articles/115005082927-Integrate-a-Custom-Ecommerce-Cart-or-Platform

icon

Best answer by elisegaines 10 August 2021, 21:15

View original

6 replies

Userlevel 5
Badge +25

Hi @Vijay! Those are great questions. 

A user is cookied in Klaviyo if they do one of three things: 

  • Click a link in an email you send through Klaviyo 
  • Fill out a Klaviyo signup form 
  • Certain custom solutions that use our APIs

The first two are the main ones to focus on -- filling out forms or clicking emails is the main way someone would become cookied. 

If someone starts a checkout and then ends up completing it, there’s no need to remove the started checkout event! Rather, you’ll be able to see from the “Placed Order” event that they finished their order. You can also use that event to filter people out of your abandoned cart flow if they end up placing their order. 

I hope this helps! 

Elise

Badge +2

Thankyou for your reply. Now i understand how the checkout works.

Unfortunately i cant use the first two methods since its custom build website. So i read the documentation and i can cookie the user with the following code : 

<script>
var _learnq = _learnq || [];
_learnq.push(['identify', {
'$email': '{{ customer.email }}',
'$first_name': '{{ customer.first_name }}',
'$last_name': '{{ customer.last_name }}'
}]);
</script>

Lets say i implement this when a user login to our portal, what happens when :
1. customer logged out(again call this script when logged in?, no problem)
2. customer checks keep me logged in button, so what happens if the script is called again/multiple times when the customer is already logged in?

3. And for added-to-cart script, when a customer increases the quantity, i can call the script again so which will update in Klaviyo?
4. How does this item removed from added-to-cart? Because i dont see any identifier when adding item from added-to-cart to started checkout.

 

Kindly advise on the above.

 

Thankyou

Userlevel 5
Badge +25

Hey Vijay, great followup questions. You can still use the first two methods to cookie users as well, even with a custom site! And the API method you outlined works as well. 

  1. When a customer logs out, they’ll still be cookied -- logging out won’t remove the cookie. The cookie will only go away if their browser removes it (e.g., if they click “clear all cookies” in their browser settings) 
  2. It’s ok if they get cookied repeatedly by logging in repeatedly! No problem :) 
  3. The Add to Cart script should run once each time a person adds something to their cart, so there is one Add to Cart event per item in their cart 
  4. We don’t have a default “Removed from cart” event, but you can certainly custom build one if you want! 
Badge +2

Hi Elise,

 

Thankyou for your kind response.

 

For Added-to-cart i don’t see a “$eventid” associated with it, so what i’m thinking is how can i run abandoned cart flow if i cant remove the item from the cart or marked it as ordered/checkout.

And if an item exists in the cart and i need to update the quantity, so im sending the same parameters with update in quantity. Will that work or it will create a duplicate..

 

Thanks in advance.

Userlevel 5
Badge +25

Hey Vijay, 

Events can’t be edited retroactively, even with an event ID. Rather, Klaviyo accepts each new event when it happens, and treats them discretely. Then, within Klaviyo, you can handle multiple similar events using flow filters, so folks aren’t receiving duplicate messages. 

 

So, for example, lets say someone adds three items to their cart, then initiates a checkout. They should have these four events: 

Add to Cart - item 1

Add to Cart - item 2

Add to Cart - item 3 

Started checkout - all three items 

 

So when they go through the Add to Cart and Started Checkout flows, you should have filters in place (like “Started Checkout zero times since starting this flow” on the Add to Cart flow), and the filter will kick them out of the Add to Cart flow, so they only get the Started Checkout flow. 

 

If that customer then removed an item from their cart, you could trigger a new “Started Checkout” event with the updated quantity if you wanted -- and again, use filters in your Started Checkout flow so they only get the flow one time. 

 

I think these articles might be helpful if you’d like more clarification about Klaviyo’s data model: https://help.klaviyo.com/hc/en-us/categories/360002500632-Architecture-Data-Model 

Badge +2

Thankyou for the answers. I get it, i should be following the product sku or product id to handle this flow. I was confused thinking the flow with event_id.

 

Thanks again.

Reply