Authentication (SDK) for Customer.io: get identity right so retention flows actually work

Customer.io partner logo

Table of Contents

Summarize this documentation using AI

This banner was added using fs-inject

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Overview

If you’re sending retention journeys out of Customer.io, authentication is the difference between “we triggered the flow” and “the right person actually got it.” If you want a second set of eyes on your identity + event design before you scale automations, book a strategy call and we’ll pressure-test it like an operator would.

In most D2C apps, the messy part isn’t sending messages—it’s stitching behavior across anonymous browsing, app sessions, and logged-in purchase activity. Customer.io’s SDK-side authentication pattern is how you prevent duplicate profiles, missing cart events, and “reactivation” campaigns that accidentally target active buyers.

How It Works

On the SDK side, you’re managing two states: anonymous activity (device-based) and known activity (user-based). The moment someone logs in (or you can confidently recognize them), you want Customer.io to associate the device/session with a stable customer identity so every downstream segment and journey has clean inputs.

  • Anonymous state: the SDK can collect events tied to a device/session before you know who the customer is (common in product discovery and browsing).
  • Authenticated/identified state: once the customer logs in or you otherwise know who they are, you call identify with your durable identifier (usually your internal user_id). From that point on, events should land on the same person profile.
  • Identity stitching: the operational goal is to merge pre-login behavior (viewed product, added to cart) into the post-login profile so cart recovery and browse retargeting don’t split across multiple “people.”
  • Event integrity: retention automations live and die on event timing and uniqueness. If “Checkout Started” fires twice, you’ll over-message. If “Order Completed” arrives late, you’ll send abandonment to a buyer.

Real D2C scenario: a shopper installs your app, browses for 3 days, adds a product to cart, then finally logs in to check shipping. If you only start tracking after login, you lose the browse + cart context. If you track before login but don’t stitch identities correctly, you’ll run cart recovery to an anonymous profile that can’t receive email/SMS—while the real customer profile looks “inactive.”

Step-by-Step Setup

The cleanest implementations treat authentication as a first-class tracking milestone. You’ll set up the SDK, start capturing key events immediately, then “lock in” the identity as soon as you can do it confidently.

  1. Install the Customer.io SDK for your platform
    • Add the iOS/Android (or React Native/Flutter) SDK to your app.
    • Confirm the workspace/site settings and SDK key match the environment (dev vs prod). In practice, environment mix-ups are a top cause of “events are firing but nothing shows up.”
  2. Start tracking critical pre-login events immediately
    • Track product discovery events like Product Viewed, Collection Viewed, Search Performed.
    • Track commerce intent events like Added to Cart, Checkout Started.
    • Include stable event properties you’ll segment on later: sku, price, category, cart_value, currency.
  3. Call identify as soon as the user is known
    • On login/signup, call the SDK’s identify with your internal user_id (not email as the primary key unless your system truly guarantees it never changes).
    • Attach customer attributes you’ll use for retention: email, phone, first_name, marketing_opt_in, country, timezone.
    • If your app supports “magic link” or SSO, make sure identify fires after the session is confirmed—not when the link is clicked. Otherwise you’ll identify the wrong person on shared devices.
  4. Track post-login revenue events with purchase IDs
    • Fire Order Completed (or equivalent) with order_id and line items.
    • Use order_id as your idempotency anchor internally so retries don’t create duplicate “purchases” that inflate LTV and break replenishment logic.
  5. Handle logout explicitly
    • When a user logs out, reset the SDK identity (per the SDK’s logout/reset pattern) so the next user on the device doesn’t inherit the previous customer’s profile.
    • This matters a lot for household tablets and retail associate devices—common edge cases that quietly poison segments.
  6. QA identity stitching end-to-end
    • Run a test: browse anonymously → add to cart → log in → complete purchase.
    • Verify all events land on a single person in Customer.io and that the device is associated correctly for push/in-app.

When Should You Use This Feature

You lean on SDK authentication any time your retention program depends on app behavior that happens before login, or when customers switch devices. If your journeys rely on “what they did,” not just “who they are,” identity has to be right.

  • Cart recovery in an app-first funnel: capture Added to Cart pre-login, then stitch on login so you can email/SMS/push the right customer with the exact items.
  • Repeat purchase and replenishment: if orders happen in-app but email capture happens later (or vice versa), authentication keeps purchase history and messaging permissions on one profile.
  • Reactivation based on intent: “Viewed 3+ products in the last 7 days but no purchase” only works if those views aren’t stranded on anonymous profiles.
  • Cross-device continuity: customers browse on mobile web, buy in-app, then expect order updates via email—authentication + consistent identifiers are what make that seamless.

Operational Considerations

Most retention programs don’t fail because the journey logic is wrong—they fail because the underlying identity graph is fragmented. Treat authentication as part of your data pipeline, not a one-time SDK task.

  • Segmentation depends on a single “source of truth” identifier: pick a durable user_id and use it everywhere (SDK identify, backend events, data warehouse exports). Mixing email-based and ID-based identity is where duplicates come from.
  • Data flow timing: cart recovery often runs on short windows (30–120 minutes). If identify happens late (e.g., only after checkout), your abandonment logic will miss the best moment.
  • Orchestration reality: if you also send events from your backend (Track API) and from the app (SDK), define which system owns each event. A common pattern is: app owns Product Viewed/Added to Cart, backend owns Order Completed.
  • Consent and channel readiness: don’t assume identified = marketable. Keep explicit fields like email_opt_in and sms_opt_in and gate journeys accordingly.
  • Duplicate people resolution: even strong teams end up with duplicates after app updates or auth refactors. Plan a periodic audit: profiles with same email, different IDs; devices attached to multiple people.

Implementation Checklist

If you want authentication to actually improve retention performance (not just “connect the SDK”), use this as your go/no-go list before you build more journeys on top.

  • SDK installed in the correct environment (dev/prod separated) and verified with live events
  • Clear identity key chosen (internal user_id) and used consistently
  • identify called on login/signup with required attributes (email/phone/consent/timezone)
  • Pre-login events tracked (view, add_to_cart, checkout_started) with useful properties
  • Post-login purchase event includes order_id and line items; duplicates prevented
  • Logout/reset implemented to avoid profile contamination on shared devices
  • End-to-end QA: anonymous → login → purchase lands on one profile
  • Segments/journeys gated by consent fields, not just presence of contact info

Expert Implementation Tips

These are the small decisions that keep your retention engine stable when volume scales and edge cases show up.

  • Identify earlier than you think: if your app has email capture before full account creation (waitlist, save cart, wishlist), identify as soon as you can confidently map to a real person. That’s how you make browse/cart data usable for email recovery.
  • Standardize event names and properties: keep the same schema across app and backend. When teams “just ship” cartValue in one place and cart_value in another, segments silently undercount.
  • Use a single cart identifier: include cart_id on Added to Cart and Checkout Started. It makes deduping and troubleshooting dramatically faster.
  • Protect against retries: mobile networks are flaky. Make sure your event pipeline tolerates retries without creating duplicate revenue events that trigger “VIP” logic too early.
  • Instrument “auth success” as an event: tracking Login Succeeded (with method) helps you debug why identity stitching broke after a release.

Common Mistakes to Avoid

These are the patterns that create noisy segments, wasted sends, and broken cart recovery—usually discovered after you’ve already scaled spend.

  • Using email as the primary identifier when emails can change: it creates split histories and makes LTV-based targeting unreliable.
  • Delaying identify until after purchase: you’ll miss high-intent windows like cart abandonment and browse recovery.
  • Not resetting on logout: shared devices end up with cross-contaminated profiles—then your “reactivation” hits the wrong person.
  • Tracking the same event from app and backend: double-firing Order Completed is the fastest way to ruin repeat purchase logic and attribution.
  • Missing required properties for segmentation: if Added to Cart doesn’t include SKU/category/value, your recovery messages become generic and conversion drops.
  • Assuming anonymous profiles can be messaged: without stitched identity (email/phone/push token tied correctly), your journey “runs” but nobody receives it.

Summary

If you want reliable cart recovery, repeat purchase, and reactivation in Customer.io, get SDK authentication and identity stitching right first.

Identify early, track consistently, and prevent duplicates—then build journeys on top of data you actually trust.

Implement Auth with Propel

If you’re already running retention out of Customer.io, authentication is one of the highest-leverage fixes because it improves every downstream segment and automation. When you’re ready, book a strategy call and we’ll map your app-side identify + event plan to the retention outcomes you care about (cart recovery accuracy, repeat purchase timing, and clean reactivation audiences).

Contact us

Get in touch

Our friendly team is always here to chat.

Here’s what we’ll dig into:

Where your lifecycle flows are underperforming and the revenue you’re missing

How AI-driven personalisation can move the needle on retention and LTV

Quick wins your team can action this quarter

Whether Propel AI is the right fit for your brand, stage, and stack