Layers

Migrate from AppsFlyer

Dual-send pattern, event mapping, when to switch.

View as Markdown

If you already have AppsFlyer installed and want to add or migrate to Layers, the safest path is dual-send overlap: run both SDKs for ~14 days, reconcile, then decide whether to drop AppsFlyer.

Why dual-send

  • Validate Layers' attribution numbers against AppsFlyer's baseline.
  • Identify event-name mapping gaps before cutting over.
  • Provide a rollback path if Layers' numbers don't look right.

Event-name mapping

Use Layers' standard events where possible so the CAPI relay can forward them to Meta / TikTok without a custom event_map override. A reasonable starting translation:

AppsFlyer eventLayers event
af_purchasepurchase_success
af_subscribesubscription_start
af_complete_registrationsign_up
af_add_to_cartadd_to_cart
af_initiate_checkoutpurchase_attempt
af_searchsearch
af_content_viewcontent_open
af_tutorial_completioncustom (no default Meta/TikTok mapping)
af_level_achievedcustom
af_logincustom

If you have custom AppsFlyer events (af_* you've defined), decide case-by-case: map to a standard Layers event (forwarded automatically) or keep as a custom Layers event (stored only, not forwarded unless you add an event_map override).

Dual-send sketch

// AppsFlyer (existing)
appsflyer.logEvent('af_purchase', { af_revenue: 9.99, af_currency: 'USD' });

// Layers (added) — same event
layers.track('purchase_success', {
  revenue: 9.99,
  currency: 'USD',
  product_id: 'premium_yearly',
  transaction_id: 'txn_...',
});

Run both for ~14 days. Compare:

  • AppsFlyer installs vs Layers install_id counts.
  • AppsFlyer purchase count vs Layers purchase_success count in the Events page.
  • Meta / TikTok dashboards vs Layers' reported CAPI deliveries on the ad-layer overview tab.

Expected divergence

  • For Meta + TikTok attribution, Layers should match or beat AppsFlyer (server-side CAPI vs client-side pixel).
  • For Apple Search Ads, both should be near-identical (both use the attribution token).
  • For non-Meta / non-TikTok / non-Apple ad networks, AppsFlyer has coverage that Layers does not — keep AppsFlyer for those.

Options after reconciliation

  1. Keep both. AppsFlyer for non-Meta/TikTok/Apple networks; Layers for Meta + TikTok + Apple Search + organic + content.
  2. Remove AppsFlyer if you only run on Meta/TikTok/Apple.
  3. Roll back to AppsFlyer-only if Layers' numbers don't match expectations — usually a config issue worth debugging first.

Removing AppsFlyer

Standard SDK removal — drop the AppsFlyer package, remove its init, delete any AppsFlyer-specific manifest entries (INSTALL_REFERRER, etc.). Layers continues to ingest events without interruption.

Caveats

  • There is no native Layers Swift / Kotlin SDK yet, so if you currently call AppsFlyer from native code only, you'll need to move those call sites to React Native (via @layers/react-native) or route through a server-side backend using @layers/node.

On this page