Summarize this documentation using AI
Overview
If you’re running Customer.io through an SDK (web or mobile), authentication is the difference between “nice-looking events” and retention flows that actually fire for the right person. If you want a second set of eyes on your identity strategy before you scale cart recovery or winback, book a strategy call—this is one of those areas where small implementation gaps quietly kill performance.
In most retention programs, we’ve seen attribution and segmentation break when anonymous browsing/app sessions never get stitched to the eventual logged-in buyer. The result: abandoned cart triggers miss, repeat purchase reminders go to the wrong profile, and your suppression logic doesn’t hold.
How It Works
Customer.io SDK authentication is basically about two things: (1) establishing a stable identity for a person, and (2) making sure events that happen before login don’t get stranded on an anonymous profile.
- Anonymous session first, known user later: A shopper can browse products, add to cart, and even start checkout before they log in or enter an email. The SDK records activity against an anonymous profile/device.
- Identify ties events to a real customer: When the user logs in (or you otherwise know who they are), you call
identifywith a stable identifier (usually your internal customer ID). That’s the “this device/session belongs to this person” moment. - Identity stitching (merge): Once identified, you want Customer.io to associate prior anonymous activity with the now-known person. This is what makes “Added to Cart” from 10 minutes ago eligible for your cart recovery journey even though the email only became known at checkout.
- Authenticated requests protect data quality: On web/mobile, authentication also matters for ensuring events are accepted as coming from your app (not spoofed) and for keeping tracking consistent across environments.
Real D2C scenario: A shopper on iOS adds a bundle to cart while browsing anonymously, then creates an account during checkout. If you only start tracking after login, your cart abandonment flow won’t trigger when they bounce on the payment step—because Customer.io never saw the cart events tied to their customer profile. Proper identify + stitching fixes that.
Step-by-Step Setup
Don’t treat authentication as “engineering plumbing.” It’s the foundation for suppression rules, frequency caps, and any journey that depends on accurate recency (last viewed, last added to cart, last purchased).
- Install the Customer.io SDK in your app (web or mobile) and verify basic event delivery.
Before you touch identity, confirm you can see a simple event (likeApp OpenorPage Viewed) in your Customer.io workspace activity logs for test devices/sessions. - Decide your canonical identifier (don’t improvise later).
Use a stable, internalcustomer_id(recommended) rather than email as the primary key. Emails change; IDs don’t. You can still attach email as an attribute for messaging. - Initialize the SDK without a user ID for anonymous sessions.
Let the SDK create/maintain an anonymous identity on first launch/visit so you capture product discovery and cart-building behavior before login. - Call
identifyimmediately after login/account creation.
Do this once you have high confidence the user is authenticated (successful login response, token issued). Attach key attributes at the same time (email, phone, country, marketing opt-in flags). - Confirm anonymous-to-known stitching behavior in your environment.
Run a test: browse anonymously → add to cart → log in → check that the pre-login events appear on the identified profile and that a segment like “Added to cart in last 1 hour” matches the identified user. - Track commerce events with consistent naming + payloads.
At minimum for retention:Product Viewed,Added to Cart,Checkout Started,Order Completed. Include order/cart IDs, product IDs, quantity, price, currency, and category/collection so you can build suppression and upsell logic. - Handle logout explicitly.
When a user logs out, reset/clear the identified user in the SDK so the next person on the same device doesn’t inherit the previous customer’s identity (this is a common source of “why did my husband get my emails?” issues).
When Should You Use This Feature
If your retention program depends on behavior that often happens before a customer is fully known, authentication is not optional—it’s how you keep journeys accurate and timely.
- Cart recovery that starts from app/web behavior: Trigger on
Added to CartorCheckout Started, then message once you have an email/phone. Without stitching, you’ll miss the highest-intent abandoners. - Browse abandonment / product discovery follow-ups: “Viewed 3 products in Collection X” works best when the viewing history survives login and cross-device sessions.
- Repeat purchase orchestration: Replenishment reminders and post-purchase cross-sells rely on clean
Order Completedevents tied to the right person and not split across duplicate profiles. - Reactivation and winback: You need trustworthy “last seen” and “last purchase” signals. If anonymous activity isn’t merged, you’ll treat active users like churned users and burn trust fast.
Operational Considerations
In practice, identity is where “the data is in Customer.io” still doesn’t translate into “segments match reality.” Plan for these realities upfront so your flows don’t degrade as volume grows.
- Segmentation depends on stitching timing: If you delay
identifyuntil after checkout, your “checkout abandonment” segment won’t populate in time to send a 30-minute reminder. Identify as soon as the user authenticates or provides a verified identifier. - Data flow across devices: SDK identity is device/session-scoped until you identify. If a shopper browses on mobile web then buys in-app, you’ll only unify that behavior if both surfaces identify to the same
customer_id. - Duplicate people are an ops tax: Using email as an ID, inconsistent casing, or identifying with different IDs across platforms creates duplicates. Duplicates break frequency caps and suppression (customers get multiple versions of the same message).
- Orchestration needs clean suppression signals: Cart recovery should stop on
Order Completed(or a “Cart Converted” event). If the purchase lands on a different profile than the cart, your journey won’t exit and you’ll send the classic “Did you forget something?” after they bought. - Environment separation: Keep dev/staging and production workspaces (or at least separate keys) so QA events don’t pollute segments and lifecycle metrics.
Implementation Checklist
Use this as a pre-flight before you ship anything that depends on behavioral triggers (cart, browse, post-purchase, winback). It’s faster to validate now than to debug why revenue is flat later.
- SDK installed and sending a test event successfully
- Canonical
customer_idchosen and consistent across web + mobile identifycalled immediately on login/account creation- Email/phone stored as attributes (not used as the primary ID unless you’re intentionally doing that)
- Anonymous browsing/cart events verified to merge onto the identified profile
- Logout/reset behavior implemented to prevent shared-device misattribution
- Commerce events standardized (names + required properties)
- Exit/suppression events validated (e.g., purchase exits cart recovery)
Expert Implementation Tips
These are the small operator-level decisions that usually separate “we track stuff” from “our flows hit at the right moment and don’t annoy buyers.”
- Identify earlier than you think: If you capture email at “start checkout” (even before account creation), consider identifying then—assuming you can do it confidently and compliantly. That’s how you win the 15–60 minute recovery window.
- Send a cart ID with every cart event: It makes deduping and exit logic much cleaner, especially if customers build multiple carts over time.
- Normalize product IDs across platforms: Web and app often use different SKUs/handles. Pick one canonical product ID so “Viewed Product → Bought Product” reporting and segments don’t fragment.
- Keep opt-in flags close to identity: Store
sms_opt_in,email_opt_in, andpush_opt_inas person attributes updated at identify time and whenever preferences change—this prevents accidental sends during high-volume automations.
Common Mistakes to Avoid
Most “Customer.io isn’t working” complaints in retention are actually identity issues. These are the ones we see repeatedly in D2C.
- Identifying with email in one place and customer ID in another: That creates two people and splits event history.
- Calling
identifyon app open for cached users without validating auth: If tokens expire or accounts switch, you’ll attribute events to the wrong person. - Not resetting identity on logout: Shared devices (tablets, family phones) become a deliverability and trust nightmare.
- Relying on “last event” fields without verifying merge behavior: Your winback logic ends up targeting active users because their activity is stuck on an anonymous profile.
- Inconsistent event schemas: If
Added to Cartsometimes includesproduct_idand sometimes doesn’t, segmentation and dynamic content degrade quickly.
Summary
If you’re using the SDK, authentication is what makes Customer.io behave like a retention engine instead of a logging tool. Identify early, stitch anonymous behavior, and keep IDs consistent across surfaces. Once that’s solid, cart recovery, repeat purchase, and reactivation flows become dramatically more reliable.
Implement Auth with Propel
If you’re tightening up SDK identity so your cart and winback journeys stop leaking revenue, it’s worth pressure-testing the plan against how Customer.io actually resolves people, devices, and anonymous activity. If you want, book a strategy call and we’ll map your current identify/event flow, spot where stitching or duplicates will break segmentation, and outline the cleanest path to production.