Summarize this documentation using AI
Overview
If you’re building retention programs in Customer.io, the SDK is where the truth comes from—who did what, on which device, and whether anonymous behavior (like browsing or carting) correctly stitches to a known customer after login or checkout. If you want a second set of hands pressure-testing identity and event design before you scale flows, book a strategy call.
In most D2C programs, the difference between “cart recovery works” and “cart recovery is a leaky bucket” is almost always SDK hygiene: consistent identify calls, stable user IDs, and events that carry the properties your segments and workflows depend on.
How It Works
Customer.io’s SDKs (mobile and web) send two kinds of data that matter for retention execution: person data (who someone is) and behavioral events (what they did). The operational goal is simple: capture high-intent actions in real time and make sure anonymous sessions merge into the right customer profile the moment you can confidently identify them.
- Install SDK → device/session becomes trackable. As soon as the SDK initializes, you can record anonymous activity (product views, add-to-cart) even before a user logs in.
identify(userId, attributes)→ creates/updates the person. This is the stitching moment. When a user logs in, creates an account, or completes checkout, you attach their stable identifier so Customer.io can unify future events and (if you do it right) merge prior anonymous activity.track(eventName, properties)→ powers segments and triggers. Your workflows typically trigger off events likeAdded to Cart,Checkout Started,Order Completed, orProduct Viewed, then branch using properties like SKU, category, cart value, or inventory.- Attributes → segmentation backbone. Things like
email,phone,first_purchase_date,last_order_date,lifetime_value,push_enabled, andsms_opt_inlet you suppress, prioritize, and personalize retention messages.
Real D2C scenario: a shopper browses on mobile, adds a product to cart anonymously, then logs in on desktop later. If your SDK fires identify consistently at login (and you don’t rotate IDs), Customer.io can connect the earlier cart event to the now-known person—so your cart recovery flow doesn’t miss them or, worse, message the wrong profile.
Step-by-Step Setup
You’re aiming for a clean pipeline: SDK installed, identity set at the right moments, and a small set of canonical events that map directly to your retention journeys. Don’t start by tracking everything—start by tracking what you’ll actually orchestrate with.
- Create your workspace and confirm channels.
Before you wire SDK events, make sure your workspace exists and you’ve set up the channels you’ll use (email, push, SMS). Your tracking plan should reflect what you can actually send. - Pick your identifier strategy (do this first).
Decide whatuserIdrepresents across systems. In practice, this should be a stable internal customer ID (not email, not a device ID). Email can change; internal IDs shouldn’t. - Install the appropriate Customer.io SDK (web + mobile as needed).
Initialize the SDK as early as possible in app start/page load so you capture pre-login behavior (views, carting). - Implement
identifyat the real stitching moments.
Fireidentifywhen you have high confidence in the user: login, account creation, or post-checkout. Include core attributes you’ll segment on (email, phone, locale, marketing opt-ins, etc.). - Implement canonical commerce events with consistent naming.
Track a minimal set that maps to flows:Product Viewed(properties:sku,product_id,category,price)Added to Cart(properties:sku,quantity,cart_id,cart_value)Checkout Started(properties:cart_id,cart_value,items)Order Completed(properties:order_id,revenue,items,discount)
- Verify events arrive and are queryable for segmentation.
Confirm you can build segments like “Added to Cart in last 2 hours AND no Order Completed” and that properties (likecart_value) are usable in conditions. - Harden logout and identity changes.
When a user logs out, reset identity appropriately so a shared device doesn’t contaminate profiles (this is a common source of ‘why did this customer get the wrong message?’ issues).
When Should You Use This Feature
SDK tracking is the right move when retention performance depends on behavioral precision—especially in mobile-heavy brands or any funnel where anonymous browsing is a big chunk of intent. If you’re still relying on “order created” webhooks only, you’ll always be late to the moments that actually recover revenue.
- Cart recovery that needs speed and accuracy. Trigger within minutes of
Added to CartorCheckout Started, then suppress instantly ifOrder Completedlands. - Product discovery → repeat purchase loops. Track
Product ViewedandCategory Viewedto drive browse abandon, replenishment, and cross-sell that reflects what they actually looked at. - Reactivation based on “silent churn” behavior. For apps, “hasn’t opened in 30 days” + “no purchase in 60 days” is more actionable than purchase history alone.
- Multi-device identity stitching. If customers browse on mobile and convert on desktop (or vice versa), SDK + consistent identify is how you stop sending irrelevant nudges.
Operational Considerations
Most tracking implementations don’t fail because the SDK is hard—they fail because teams don’t align event design to segmentation and orchestration. The result is brittle segments, duplicate profiles, and workflows that can’t reliably suppress.
- Segmentation depends on property consistency. If
cart_valueis sometimes a number and sometimes a string, your “high intent cart” segment will quietly undercount. - Data flow timing matters for suppression. Cart recovery needs near-real-time events. If
Order Completedarrives late (or only server-side), you’ll message buyers and burn trust. - Anonymous-to-known merging is where attribution breaks. If you identify too late (only after shipping confirmation, for example), you lose the ability to tie browse/cart intent to the right person.
- Orchestration reality: pick one source of truth per concept. Don’t track “Order Completed” from both client and server unless you have a dedupe strategy (same
order_id, idempotent handling). Double-firing will inflate conversion metrics and break frequency controls. - Device and channel eligibility should be attributes. For push/SMS, keep attributes like
push_enabled,push_token_present,sms_opt_incurrent so workflows can route correctly.
Implementation Checklist
Before you build a single recovery or winback flow, lock the basics. This checklist is what keeps your first campaigns from turning into a week of debugging segments and chasing ghost profiles.
- Stable
userIddefinition documented and used across web + mobile identifyfires on login/account creation/checkout (not just on app open)- Core attributes mapped: email, phone, opt-in flags, locale/timezone (where applicable)
- Canonical event names agreed and implemented consistently
- Event properties typed consistently (numbers as numbers, arrays as arrays)
- Cart and order identifiers included (
cart_id,order_id) for dedupe and joins - Logout/reset behavior implemented to prevent cross-user contamination
- Test plan: anonymous browse → add to cart → login → purchase, verified in Customer.io
Expert Implementation Tips
Once the basics work, these are the operator moves that make your retention engine more reliable and easier to scale across channels and offers.
- Design events around decisions, not analytics curiosity. If you can’t name the workflow or segment that will use an event, it’s usually noise.
- Always include IDs you can suppress against. Cart recovery is dramatically cleaner when every cart event includes
cart_idand every purchase includesorder_idand the purchased SKUs. - Send “eligibility” as attributes, not inferred logic. If push permission changes, update
push_enabledimmediately so workflows don’t attempt dead channels. - Use a single “source of truth” for revenue. In most D2C stacks, server-side order events are cleaner for revenue, while SDK events are best for intent (view/cart/checkout start). Mixing without rules is how reporting and suppression get messy.
Common Mistakes to Avoid
These are the mistakes that quietly tank recovery rates and inflate send volume—usually without anyone noticing until deliverability or complaints spike.
- Using email as the primary ID. When email changes, you fragment profiles and lose history—your “VIP” segment becomes unreliable.
- Identifying too early with low-confidence IDs. If you identify off a temporary guest token, you’ll create duplicates and mis-stitch later.
- Tracking purchases client-side only. Mobile apps drop events; ad blockers exist on web. If revenue is client-only, your suppression will fail and you’ll message recent buyers.
- Inconsistent event naming across platforms. “AddToCart” on iOS and “Added to Cart” on web forces you into brittle segments and duplicated workflow logic.
- No logout/reset handling. Shared devices (tablets, family phones) will leak behavior across people and create ‘creepy’ personalization.
Summary
If you want Customer.io retention flows to trigger reliably, start with SDK identity and a small set of canonical commerce events. Get stitching right, keep properties consistent, and your cart recovery and repeat-purchase orchestration becomes straightforward.
If you’re debating whether to track something, tie it to a segment or suppression rule first—execution beats data hoarding every time.
Implement 3.x with Propel
When teams roll out SDK tracking, the work isn’t the install—it’s making sure identity stitching, event schemas, and suppression timing hold up once real customers start bouncing across devices and channels. If you’re implementing in Customer.io and want an operator’s POV on what to track (and what to ignore) for cart recovery, repeat purchase, and reactivation, book a strategy call.
In practice, we’ll usually sanity-check your identify moments, define the canonical event list, and pressure-test a full anonymous→known→purchase path so your first retention workflows don’t ship on shaky data.