Skip to content
Docs and guides

Help Center

Step-by-step guides for every setting in App Studio.

Firebase Analytics

Updated

Screen views, events and funnels in your Firebase project.

Enable a native plugin, configure its settings, then rebuild and install the app.
Native plugin changes require a new build. Follow this guide for the exact settings and supported methods.View full size
  • JavaScript: window.AppSorcerer.firebaseAnalytics
  • Plan: Essential — included in every plan
  • Platforms: Android apps today. iOS support arrives with iOS builds (coming soon).
  • Needs: your Firebase google-services.json file, uploaded in Push Notifications

Turn the plugin on in App Studio → Plugins, fill in its settings, then rebuild your app. Websites call it through the JavaScript bridge.

Settings

Studio labelTypeDefaultNotes
Log a screen view for every pagetoggletrue
Collect data by defaulttoggletrue

Setup

Upload your google-services.json file in Push Notifications. Without it the plugin stays off and calls reject with not_configured.

JavaScript API

Every method returns a Promise. Call it as await AppSorcerer.firebaseAnalytics.<method>(args).

MethodArgumentsNotes
logEvent{ name, params? }Names/keys are cleaned to Firebase rules (letters, digits, _, max 40); string values max 100 chars; items arrays of objects become Bundle arrays (ecommerce). Needs consent
logScreenView{ screenName, screenClass = 'WebView' }Needs consent
setUserId{ userId } (null clears)Needs consent (clearing always works)
setUserProperty{ name, value }name max 24, value max 36. Needs consent (clearing with value: null always works)
setCollectionEnabled{ enabled }Always works
setDefaultParams{ params } (null clears)Needs consent (clearing always works)
setConsent{ analyticsStorage?, adStorage?, adUserData?, adPersonalization? } (booleans)Consent Mode v2. Always works
getAppInstanceId–{ appInstanceId }. Needs consent
resetAnalyticsData–Always works

The plugin respects each shopper's consent decision from your store's Shopify Customer Privacy API (window.Shopify.customerPrivacy) — the same API your Shopify cookie banner uses.

  • Before every automatic screen view and every call marked Needs consent, the app asks the page whether Shopify.customerPrivacy.analyticsProcessingAllowed() is true.
  • Allowed: the event is sent. Not allowed (including "not decided yet" in regions that require consent): the screen view is skipped and the call rejects with consent_denied; nothing is sent to Firebase.
  • When the shopper accepts or declines in the cookie banner (Shopify's visitorConsentCollected event), the app remembers the new choice for your store for the rest of the session.
  • If your store's consent API loads late, the app asks again for up to 1.5 seconds before deciding. Websites that are not Shopify stores, or stores without the consent API, keep working as before: your website decides what to send.
  • The app never turns collection on or off by itself — Collect data by default and setCollectionEnabled keep working as described below.

Errors

Rejections carry error.code: not_configured, invalid_args, unavailable, unknown_method, consent_denied (the shopper has not consented to analytics — expected on stores with a cookie banner; handle it quietly).

Example

JavaScript
await AppSorcerer.firebaseAnalytics.logEvent({
  name: 'add_to_cart',
  params: { currency: 'EUR', value: 29.9, items: [{ item_id: 'SKU-1', item_name: 'Mug', quantity: 1 }] },
});

Notes

  • Log a screen view for every page logs screen_view with the page path as screen_name and the page address without its query string or #fragment as page_location (so e-mail addresses, tokens or order numbers in links are never sent). It only runs when the shopper has consented (see Shopper consent).
  • Collect data by default decides whether Analytics collects data from the first launch.
Was this helpful?