Articles on: CornerCart

How to send events from cart to analytics apps


This guide explains how to track specific user events that occur within the Corner Cart application. Integrating these events with your analytics platform (e.g., Growlytics, Mixpanel) is crucial for optimizing the user experience and understanding cart behavior in your store.


⚙️ Prerequisites


Before implementing event tracking, ensure your chosen analytics platform is properly integrated with your store via its JavaScript snippet, and have the platform's event capture function ready.


Few example docs of such tools

Note: This document focuses exclusively on obtaining event data from Corner Cart. For details on setting up your analytics account or application, please refer to your platform's dedicated support team.


🎯 How to Implement Event Tracking


All event tracking is managed via a custom JavaScript listener placed in the Corner Cart settings.


Implementation Steps


  1. Navigate to the Corner Cart app.
  2. Go to Cart drawer > Advanced Settings.
  3. Paste the required JavaScript snippets into the "Custom JS Script" area.

The core function for listening to events is corner.on(eventName, callback).


📦 Available Cart Events


Corner Cart exposes a set of events that capture various user interactions.

Event Name

Description

Triggered When

onCartEdit

Cart Change

Any item/quantity change occurs in the cart.

onCowiOpen

Widget Open

The cart widget is opened.

onCowiClose

Widget Close

The cart widget is closed.

onCartCtaClick

Checkout Click

The main Call to Action (CTA)/Checkout button is clicked.

onUpsellCtaClick

Upsell Click

The CTA button on an upsell product is clicked.

onDiscountCodeAdd

Discount Add

A user successfully adds a discount code.

onDiscountCodeRemove

Discount Remove

A user removes an existing discount code.

onSatcCtaClick

Sticky CTA Click

The CTA button on the Sticky Add to Cart bar is clicked.

onCartGoalMilestoneAchieve

Goal Milestone Achieved

A user meets the criteria for a new cart goal milestone.

onCartGoalMilestoneLost

Goal Milestone Lost

A user no longer meets the criteria for a previously achieved milestone.


🛠️ Event Listener Snippets


Below are the specific code snippets you will paste into the "Custom JS Script" area. Remember to replace the comment with your analytics platform's event capture code.


1. Track Cart Edits (onCartEdit)


Captures any change to the cart's contents (add, remove, quantity update).

JavaScript

corner.on("onCartEdit", (params) => {
// Insert the event capture snippet from your analytics app here
console.log("Cart Edited:", params);
});

params Property

Description

cartDetails

Object containing the current state of the cart.

cartEdits

Array of edit objects detailing the specific changes made.


2. Track Cart Widget Interactions



Open Cart Widget (onCowiOpen)


JavaScript

corner.on("onCowiOpen", (params) => {
// Insert the event capture snippet from your analytics app here
});


Close Cart Widget (onCowiClose)


JavaScript

corner.on("onCowiClose", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current state of the cart.


3. Track Checkout Click (onCartCtaClick)


Captures clicks on the primary Call to Action (usually "Checkout").

JavaScript

corner.on("onCartCtaClick", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current state of the cart.


4. Track Upsell Product Interactions



Upsell CTA Click (onUpsellCtaClick)


Captures clicks on a CTA for an upsell product featured inside the cart.

JavaScript

corner.on("onUpsellCtaClick", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.

productAdded

Object containing details of the specific variant the user just added.


5. Track Discount Code Management



Discount Code Added (onDiscountCodeAdd)


JavaScript

corner.on("onDiscountCodeAdd", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.

discountCodeAdded

Object with details about the discount code the user just applied.


Discount Code Removed (onDiscountCodeRemove)


JavaScript

corner.on("onDiscountCodeRemove", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.

discountCodeRemoved

Object with details about the discount code the user just removed.


6. Track Sticky Add to Cart Click (onSatcCtaClick)


Captures clicks on the CTA in the Sticky Add to Cart bar.

JavaScript

corner.on("onSatcCtaClick", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.


7. Track Cart Goal Milestones



Milestone Achieved (onCartGoalMilestoneAchieve)


Captures when a user reaches a new milestone in a cart goal campaign.

JavaScript

corner.on("onCartGoalMilestoneAchieve", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.

achievedMilestoneIndex

Position of the milestone achieved (starting from 1).


Milestone Lost (onCartGoalMilestoneLost)


Captures when a user removes items and drops below the requirement for a previously achieved milestone.

JavaScript

corner.on("onCartGoalMilestoneLost", (params) => {
// Insert the event capture snippet from your analytics app here
});

params Property

Description

cartDetails

Object containing the current cart state.

lostMilestoneIndex

Position of the milestone lost (starting from 1).

Would you like me to help you draft an example of how one of these snippets would look using a generic analytics function, like trackEvent()?

Updated on: 18/11/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!