Layers

Run Alongside Firebase Analytics

Layers + Firebase coexistence pattern.

View as Markdown

Firebase Analytics is a good product-analytics tool. Layers does NOT replace it. Recommended pattern: run both.

Roles

ToolPurpose
LayersAd attribution (Meta / TikTok / Apple Search), organic content, UGC, paid media management.
Firebase AnalyticsProduct analytics — funnel, retention, cohorts, custom dashboards.

Both can ingest the same events. They don't conflict.

Pattern

Wrap your event-firing in a single function:

async function trackEvent(name: string, properties: Record<string, unknown>) {
  await layers.track(name, properties);
  firebase.analytics().logEvent(name, properties);
}

One call site, two destinations.

Naming & property limits

Firebase has strict rules: event names up to 40 chars, parameter keys up to 40 chars, specific reserved prefixes (firebase_*, google_*, ga_*). Layers is more permissive, but pick names that satisfy Firebase's constraints if you're going to dual-fire — it keeps your call sites identical.

Firebase has setAnalyticsCollectionEnabled. Layers has setConsent. Wire both to your CMP:

function applyConsent(granted: boolean) {
  layers.setConsent({ analytics: granted, advertising: granted });
  firebase.analytics().setAnalyticsCollectionEnabled(granted);
}

Bundle size

Both SDKs add native code on RN apps. Exact impact depends on versions and which Firebase modules you pull in (Analytics, Crashlytics, etc.). Measure in your app; per-SDK claims in prior versions of this page were not measured.

On this page