Summarize this documentation using AI
Overview
If you’re running Customer.io for a D2C brand, in-app event listeners are how you turn real on-site/app behavior into reliable retention triggers—without guessing who did what. If you want help pressure-testing your tracking plan before you ship, book a strategy call and we’ll map the minimum event set that actually moves repeat rate and recovery.
At the operator level, the goal isn’t “track more.” It’s to track the few moments that let you intervene: cart started, checkout started, product viewed, subscription skipped, reorder intent, and post-purchase engagement—tied cleanly to the right person.
How It Works
In-app event listeners sit on the client side (your mobile app or website) and fire events into Customer.io when a user does something meaningful. The critical detail is identity: your SDK needs to associate anonymous browsing with a known customer as soon as you have an identifier (email, customer ID, phone), so Customer.io can stitch the timeline and your campaigns don’t misfire.
- SDK initializes when your app/site loads, establishing a device/session context.
- Anonymous events can be captured early (e.g., product viewed) before login—useful, but only if you later identify the user so those events attach to a real profile.
- Identify call links the device to a person (e.g., after login, account creation, or email capture). This is where most retention programs either become reliable—or quietly rot.
- Track calls send events + properties (e.g., SKU, cart value, category). These properties become your segmentation fuel and your campaign decision logic.
- Customer.io uses events for entry + branching in campaigns/workflows, so your cart recovery and replenishment messages trigger off behavior instead of time-based guesses.
Step-by-Step Setup
Before you touch code, align on the retention outcomes you’re driving (cart recovery, second purchase, winback). Then implement only the events that power those flows, with tight naming and consistent properties so segmentation doesn’t turn into a cleanup project.
- Install the Customer.io SDK for your platform (iOS/Android/React Native/Web). Initialize it at app start (or site load) so session context is consistent.
- Define your identity strategy:
- Pick a stable primary identifier (usually your internal customer ID).
- Decide when you’ll call
identify(login, signup, email capture, order confirmation). - Plan for guest checkout: you still need to identify once you collect email/phone.
- Implement
identifyimmediately after you have a real identifier and attach key attributes (email, phone, acquisition source, loyalty tier if applicable). Don’t wait until after purchase—by then you’ve already lost cart recovery value. - Set up in-app event listeners for the specific retention moments you’ll act on:
product_viewed(properties: sku, category, price)added_to_cart(sku, quantity, cart_value)checkout_started(cart_value, shipping_country)purchase_completed(order_id, order_value, items[])subscription_skippedorreorder_clicked(where relevant)
- Standardize event properties so you can segment without hacks:
- Use consistent keys (
skunot sometimesproduct_sku). - Send numbers as numbers (cart_value as numeric, not a formatted string).
- Include currency when you operate multi-currency.
- Use consistent keys (
- Validate in Customer.io Activity Logs:
- Confirm events arrive under the correct person after identify.
- Confirm anonymous activity merges/stitches the way you expect.
- Confirm properties are present and typed correctly.
- Wire events into campaigns:
- Use
added_to_cartorcheckout_startedas entry triggers. - Branch on properties (cart_value, category, first-time vs repeat).
- Add exit conditions (purchase_completed) so you don’t keep nudging buyers.
- Use
When Should You Use This Feature
In-app event listeners are worth the effort when timing and relevance matter—meaning you need to respond to what a shopper just did, not what you assume they did based on a batch import or a daily sync.
- Cart abandonment recovery when you want to differentiate “added to cart” vs “started checkout” and personalize based on SKUs and cart value.
- Product discovery to second purchase when you want to follow up based on category interest (e.g., skincare shopper browsing moisturizers twice but not purchasing).
- Reactivation based on real inactivity (no app opens, no product views) instead of blunt “90 days since last order.”
- Subscription retention when you need to react to skip/cancel intent signals in-app before the churn happens.
Real D2C scenario: A shopper adds two items to cart in your mobile app (one hero SKU, one accessory), starts checkout, then bounces at shipping. With clean SDK events, you can trigger a checkout recovery flow within minutes, branch by shipping_country (different thresholds/offers), and suppress the entire flow instantly if purchase_completed fires on another device.
Operational Considerations
This is where most teams feel the pain later: segmentation breaks when events aren’t consistent, and orchestration breaks when identity isn’t stitched. Treat the SDK as production infrastructure, not a one-time integration.
- Segmentation depends on property hygiene: if
categoryis missing on 30% ofproduct_viewedevents, your “category interest” segments will undercount and your flows will look weaker than they are. - Data flow realities: mobile events can arrive late (offline mode). Build reasonable delays (e.g., wait 30–60 minutes before sending cart recovery) and always use purchase exits to prevent awkward sends.
- Identity stitching is the linchpin:
- If you identify too late, anonymous cart events won’t power recovery.
- If you identify inconsistently (email sometimes, customer_id other times), you’ll create duplicates and suppressions won’t work reliably.
- Orchestration across channels: if you’re using push + email + SMS, don’t let each channel trigger off slightly different events. Pick one canonical event (e.g.,
checkout_started) and orchestrate channel order inside the workflow. - Event volume and noise: avoid tracking every tap. In most retention programs, we’ve seen performance improve when teams cut events down to the ones they’ll actually use for segmentation or branching.
Implementation Checklist
Use this to sanity-check your SDK implementation before you build automations on top of it. It’s much cheaper to fix naming and identity now than after you’ve launched five flows.
- SDK installed and initialized at app start / site load
- Single primary identifier chosen (prefer internal customer ID)
identifyfires immediately after login/signup/email capture- Core retention events implemented:
product_viewed,added_to_cart,checkout_started,purchase_completed - Event properties standardized (sku, category, cart_value, currency, order_id)
- Anonymous activity merges correctly after identify
- Activity Logs confirm correct person attribution and property types
- Campaign exits configured using
purchase_completed - Reasonable delays added to account for late-arriving mobile events
Expert Implementation Tips
These are the small operator moves that keep your retention machine accurate as you scale channels, SKUs, and platforms.
- Version your event schema (even informally). When you add a new property, roll it out consistently across platforms so segments don’t fork.
- Send item arrays on purchase (items with sku/qty/price). It unlocks smarter post-purchase cross-sell and category-based replenishment without extra ETL work.
- Prefer “intent” events over UI events: track
checkout_startedwhen the user hits the real checkout step, not when they open the cart drawer. - Use a short hold before recovery (15–60 minutes) to reduce false positives from users who bounce between apps, payment methods, or devices.
- Make identity deterministic: if your app supports both phone and email, still anchor to one internal ID and treat email/phone as attributes, not the primary key.
Common Mistakes to Avoid
Most “Customer.io isn’t working” complaints are really tracking and identity issues. Fix these and your automations usually snap into place.
- Calling identify too late (post-purchase). You lose cart recovery and browse follow-up because the events stay anonymous.
- Inconsistent event names across platforms (iOS sends
add_to_cart, Android sendsadded_to_cart). Your segments silently miss half your audience. - Missing purchase exit conditions. This is how customers get “complete your order” after they already bought.
- Over-tracking and then trying to segment on noisy events. In practice, this tends to break when the app team refactors UI and your “button_clicked” logic changes.
- Using email as the only identifier when users change emails or use Apple Private Relay. Duplicates creep in and suppression becomes unreliable.
Summary
If you want retention campaigns to trigger off real behavior, in-app event listeners are the foundation. Get identity stitching right, keep the event schema tight, and you’ll unlock reliable cart recovery, smarter repeat purchase flows, and cleaner reactivation targeting.
Implement In App Actions with Propel
Once your SDK events are clean, the next step is turning them into consistent in-app actions (and coordinating those actions with email/push/SMS) inside Customer.io. If you want a second set of eyes on your event schema, identity plan, and the exact triggers that will lift repeat purchase, book a strategy call—we’ll help you ship the minimum viable tracking that actually drives revenue.