Native App Analytics Integration with Firebase and GA4

Overview

PAR Ordering hybrid apps (iOS and Android) send analytics events through Firebase to your Google Analytics 4 (GA4) property. Your native app traffic appears in dedicated iOS app and Android app data streams in GA4, separate from your web stream.

Without this integration, a Capacitor-based hybrid app sends events using gtag.js inside the webview, which does not produce proper app-stream data in GA4.

This feature requires configuration by the PAR team. Contact your PAR representative to enable native app analytics for your brand's iOS or Android app.

How It Works

GA4 receives native app events only through Firebase. When a guest uses your brand's iOS or Android app, the app sends analytics events to the Firebase Analytics SDK. Firebase then forwards those events to your brand's GA4 property under the app streams.

The web path is unchanged. If a guest uses a browser instead of the native app, events continue to route to your existing GA4 web stream through gtag.js.

Analytics collection is off by default. On both iOS and Android, the app does not collect any data (including first_open) until the guest accepts the cookie consent prompt.

Prerequisites

Before PAR can enable native app analytics for your brand, you need the following in place:

  • A GA4 property for your brand

  • A Firebase project for your brand's native apps, with iOS and Android registered in the same project when both platforms use the same GA4 property

  • The iOS app bundle ID and Android app package name for your brand's app

  • Google Analytics enabled in your Firebase project

    Firebase projects created only for Firebase Cloud Messaging (FCM) sometimes have Google Analytics disabled. Verify this in your Firebase project settings before proceeding.

  • Your Firebase project linked to your brand's GA4 property

    You can link the project in Firebase Console > Project settings > Integrations > Google Analytics.

  • Separate Firebase apps or streams for development/staging and production environments, so test traffic does not appear in your production GA4 data

Set Up Firebase for Your Native App

Complete the following steps in Firebase Console before providing config files to PAR.

1. Register Your Apps in Firebase

  1. In Firebase Console, open your Firebase project.
  2. Register your iOS app using your bundle ID.
  3. Register your Android app using your package name.
  4. Confirm that Google Analytics is enabled for the project.
  1. In Firebase Console, go to Project settings > Integrations > Google Analytics.
  2. Link your brand's GA4 property.
  3. In GA4, confirm that an iOS app data stream and an Android app data stream appear under your property. These are separate from your existing web stream.

3. Download Per-Environment Config Files

Download the config files for each environment (development/staging and production):

  • iOS: GoogleService-Info.plist
  • Android: google-services.json

Use separate config files for each environment. Using a single config file across environments causes test traffic to appear in your production GA4 data.

4. Provide Config Files to PAR

Send your config files to your PAR representative. PAR Engineering loads these files into your brand's build pipeline. Do not edit the files manually after downloading them from Firebase Console.

For iOS: If GoogleService-Info.plist is not included in the brand build, the app builds and runs without error but sends no analytics data to GA4. Verify that your config file is included before releasing.

Events Tracked in GA4

The following events fire automatically as guests interact with your brand's app. Event names and parameters match your web stream.

Guest action GA4 event name
Opens the app app_open, first_open, session_start
Navigates to a screen screen_view
Views a menu item view_item
Adds an item to the cart add_to_cart
Removes an item from the cart remove_from_cart
Views the cart view_cart
Begins checkout begin_checkout
Completes an order purchase and order_placed

Purchase events

When a guest completes an order, the app sends two events: purchase and order_placed. Both include the same parameters: transaction_id, value, currency, and items[].

A completed order produces exactly one purchase event. If no order ID is available at the time the event fires, the app generates a temporary transaction ID and logs a console warning. Repeated fires in that case can inflate GA4 transaction counts.

User identity

After a guest signs in, the app sets the guest's customer ID as the GA4 user ID. No personally identifiable information (PII), including email address, phone number, or name, is sent as a user property or event parameter.

When a guest signs out, the user ID is cleared.

  • Collection is disabled by default. No events fire until the guest accepts the cookie consent prompt. This applies to both iOS and Android.
  • If your brand uses the initGtagPriorConsent setting, analytics initializes before the guest accepts cookies, consistent with your existing web behavior.
  • If a guest later withdraws consent, collection stops and the user ID is no longer sent.

iOS: App Tracking Transparency

If your brand sets the APP_APPLE_TRACKING_USAGE flag in your app configuration, iOS displays the App Tracking Transparency (ATT) prompt to guests. Contact your PAR representative with questions about ATT configuration for your brand.

App Store privacy labels (iOS) and Google Play Data Safety form (Android) must reflect analytics data collection. Review and update these for your app as part of your release process.

Verify Your Setup

After PAR completes the build with your Firebase config files, verify analytics on a debug build before releasing to production.

  1. Enable Firebase Analytics debug mode on the test device: on iOS, add -FIRDebugEnabled to the launch arguments in your Xcode scheme; on Android, run adb shell setprop debug.firebase.analytics.app PACKAGE_NAME, replacing PACKAGE_NAME with your app's package name.
  2. Open DebugView in Firebase Console and launch the debug build (from Xcode for iOS).
  3. Accept the cookie consent prompt.
  4. Navigate through the app and place a test order.
  5. Confirm the following in GA4 DebugView within approximately one minute:
    • screen_view events appear with the correct screen_name
    • add_to_cart, begin_checkout, and purchase events appear
    • The purchase event includes the correct transaction_id and order total
  6. Confirm that events appear under the iOS app stream or Android app stream, not the web stream.
  7. Confirm that a web browser session for the same brand routes to the web stream with no duplicate events.

Notes

Note Details
GTM containers are skipped on native Google Tag Manager does not run in the hybrid app. Any non-GA4 tags in your GTM container will not fire in the app. GA4 tags are handled by Firebase and are not affected.
Web events do not fire inside the native app On native, the app sends events to Firebase only. gtag.js, GTM, and legacy analytics.js are skipped. Events are not double-counted across web and app streams.
Test traffic separation requires separate config files Nothing in the app enforces environment separation. Use separate Firebase apps and config files for development/staging and production.
iOS config file is optional at build time A brand built without GoogleService-Info.plist builds successfully but sends no analytics.