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
- Web Engage: https://docs.webengage.com/docs/web-tracking-events
- Google analytics: https://support.google.com/analytics/answer/12229021?hl=en
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
- Navigate to the Corner Cart app.
- Go to Cart drawer > Advanced Settings.
- 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 |
| Cart Change | Any item/quantity change occurs in the cart. |
| Widget Open | The cart widget is opened. |
| Widget Close | The cart widget is closed. |
| Checkout Click | The main Call to Action (CTA)/Checkout button is clicked. |
| Upsell Click | The CTA button on an upsell product is clicked. |
| Discount Add | A user successfully adds a discount code. |
| Discount Remove | A user removes an existing discount code. |
| Sticky CTA Click | The CTA button on the Sticky Add to Cart bar is clicked. |
| Goal Milestone Achieved | A user meets the criteria for a new cart goal milestone. |
| 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 |
| Object containing the current state of the cart. |
| 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 |
| 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 |
| 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 |
| Object containing the current cart state. |
| 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 |
| Object containing the current cart state. |
| 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 |
| Object containing the current cart state. |
| 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 |
| 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 |
| Object containing the current cart state. |
| 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 |
| Object containing the current cart state. |
| 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
Thank you!
