Summarize this documentation using AI
Overview
If you’re using Customer.io to drive repeat purchase and recovery flows, the SDK is where retention either gets clean…or quietly breaks. The difference usually comes down to two things: (1) when you identify a user and (2) whether your events carry the right IDs and properties to stitch pre-login behavior to a real customer profile.
If you want a second set of eyes on your tracking plan before you build journeys around shaky data, book a strategy call—we’ll pressure-test identity, event naming, and the “gotchas” that cause missed sends or duplicate profiles.
How It Works
At a practical level, the Customer.io SDK sits inside your app (mobile or web) and does three jobs: it creates/maintains a device-level identity, it sends behavioral events, and it ties that behavior back to a known person once you have a stable identifier (email, customer ID, etc.). Retention teams feel the impact when anonymous sessions (browse, PDP views, add-to-cart) don’t merge cleanly after login or checkout—your cart recovery ends up incomplete or mis-targeted.
- Anonymous activity starts first: the SDK can track events before a user logs in. That’s how you capture product discovery and cart building in-session.
- Identify is the stitch point: once you call
identifywith your canonical user ID (and usually email), Customer.io can associate future events—and often prior anonymous activity—with that person. - Events become segmentation fuel: every
trackcall (e.g.,Product Viewed,Added to Cart,Checkout Started,Order Completed) becomes something you can filter on inside segments and use as triggers/conditions inside Journeys. - Device context matters for channel reach: SDKs typically manage device tokens/permissions for push and in-app. If device registration is flaky, your “push-first cart recovery” will underdeliver even when the journey logic is perfect.
Real D2C scenario: a shopper opens your app from a paid ad, views two PDPs, adds a bundle to cart, then closes the app. Later they come back, log in, and complete checkout. If you don’t track the pre-login cart events and then stitch them at login, your cart abandonment journey can misfire (or worse—send a “you left something behind” message after they purchased).
Step-by-Step Setup
Before you touch Journeys, get the app-side fundamentals right. In most retention programs we’ve seen, teams rush to build flows and only later realize the SDK is creating duplicate people or dropping key events—then you’re rebuilding segmentation and suppression logic under pressure.
- Install the correct Customer.io SDK for your app stack.
Pick the native SDK (iOS/Android) or your framework SDK (React Native/Flutter/Expo). Confirm you’re on a current version so identity and device handling behave as expected. - Initialize the SDK as early as possible in app startup.
This ensures you capture first-session discovery events and attribution context. Late initialization is a common reason “first open → browse → cart” events never show up. - Define your canonical identifier strategy.
Decide what goes intoidentify:- Use a stable internal customer_id as the primary ID whenever possible.
- Attach email as an attribute (and update it if it changes).
- Avoid using volatile identifiers (like device ID) as the person ID.
- Call
identifyat the right moment (and only when you’re sure).
Best practice for D2C apps: call it on login, account creation, or when you have a verified email at checkout. Don’t identify on an email field blur—typos create junk profiles that pollute segments. - Track a tight retention event taxonomy.
Start with events you’ll actually orchestrate against:Product Viewed(includeproduct_id,category,price)Added to Cart(includecart_id, line items,value)Checkout Started(includecart_id,value)Order Completed(includeorder_id,value, items,discount)
- Send device and permission state as attributes.
At minimum: push token registered, push permission status, app version, and platform. You’ll use these attributes to route channel strategy (push vs email) and avoid sending “enable push” nags to people who already opted in. - Validate in Customer.io before building journeys.
Use a test device and confirm: person profile updates afteridentify, events appear in activity logs, and anonymous events are stitched to the known profile after login.
When Should You Use This Feature
The SDK matters most when the behavior you want to react to happens inside the app (or across app + web) and you need reliable identity stitching. If your retention program depends on “what someone did in the last hour” rather than “what they bought last month,” SDK tracking is usually the backbone.
- Cart recovery with real-time triggers: trigger on
Added to CartorCheckout Started, then suppress ifOrder Completedarrives within a short window. - Repeat purchase timing: use
Order Completedplus item-level properties to time replenishment or cross-sell (e.g., 21 days after a 30-day supply ships). - Browse-based reactivation: if someone repeatedly views a category but never purchases, you can build “interest segments” that don’t rely on email clicks as the signal.
- Push-first orchestration: when you want to lead with push/in-app and fall back to email only if the device isn’t reachable.
Operational Considerations
SDK tracking isn’t just “engineering setup”—it changes how you segment, suppress, and sequence messages. In practice, this tends to break when multiple IDs exist for the same human or when events arrive out of order (common on mobile with flaky connectivity).
- Segmentation depends on event consistency: if
Added to Cartsometimes sends withoutcart_idor without line items, your cart segments will be leaky and your dynamic content will fail. - Identity stitching rules your suppression logic: cart recovery needs a single customer timeline. If anonymous carts don’t merge after login, you’ll message the wrong “person” or miss the right one.
- Data flow latency can cause false positives: mobile events may batch and arrive late. Build short guardrails like “wait 30–60 minutes” before sending, and always add an exit condition on
Order Completed. - Cross-platform parity is non-negotiable: if web tracks
Checkout Startedbut app doesn’t, you’ll create channel bias in your segments and misread funnel drop-off. - Orchestration needs channel reach attributes: keep push token + permission status up to date so Journeys can branch cleanly (push if reachable, email if not).
Implementation Checklist
If you want the SDK to reliably power retention journeys, treat this like a launch checklist—not a “we’ll clean it up later” task. Getting this right upfront saves weeks of debugging segments and duplicate profiles.
- SDK installed and initialized at app start (iOS/Android/framework)
- Canonical person ID defined (stable
customer_id) identifycalled only after login/account creation/verified checkout- Core retention events implemented with consistent names and required properties
Order Completedincludesorder_idand total value (plus line items if possible)- Push token + permission state captured as person attributes
- Test plan executed: anonymous browse → login → purchase, and verify stitching
- Basic suppression/exit logic planned (purchase exits cart recovery)
Expert Implementation Tips
These are the operator moves that keep your retention program stable as volume grows and the app evolves.
- Use “event contracts” with engineering: write down required properties per event (e.g.,
cart_id,value,currency). Treat missing properties as a bug, not a nice-to-have. - Prefer internal IDs over emails for identity: emails change; customer IDs don’t. Keep email as an attribute you update.
- Add idempotency where possible: for purchase events, include a unique
order_idso you can detect duplicates and avoid double-triggering post-purchase flows. - Design for offline/mobile batching: add a short delay before cart abandonment sends, and always re-check purchase state with an exit condition.
- Track “Viewed Category” sparingly: it’s tempting to log everything, but noisy events make segments expensive to reason about. Focus on the few signals you’ll actually use to route messaging.
Common Mistakes to Avoid
Most retention issues blamed on “Customer.io deliverability” or “journey bugs” are really SDK identity or event hygiene problems upstream.
- Identifying too early: capturing an unverified email at checkout and calling
identifycreates bad profiles and wrecks segmentation. - Different event names on iOS vs Android: you’ll end up building duplicate segments and missing half your audience.
- Missing purchase suppression: cart recovery without an
Order Completedexit condition will inevitably message buyers. - Not passing item-level properties: without line items, you can’t personalize recovery (and you can’t exclude items that are out of stock).
- Letting duplicate people accumulate: if you don’t have a clear ID strategy, you’ll see multiple profiles per human and your frequency caps won’t work.
Summary
If you want Customer.io to drive cart recovery, repeat purchase, and reactivation from in-app behavior, the SDK is the foundation. Get identify timing right, keep event naming consistent, and treat stitching as a first-class requirement.
Once the data is clean, Journeys become straightforward—and your suppression logic actually holds under real-world edge cases.
Implement How It Works with Propel
If you’re already on Customer.io, the fastest path is usually: confirm identity strategy, lock the event contract, then build 2–3 high-leverage journeys (cart recovery, post-purchase cross-sell, and winback) on top of validated tracking. That sequencing prevents the common “beautiful journey, bad data” trap.
If you want help auditing your SDK events and stitching (especially across app + web) and translating that into reliable retention orchestration, book a strategy call.