At the core of the Firebase mobile platform, Google Analytics for Firebase provides a range of insights into mobile app lifecycle events, as well as a wide variety of out-of-the-box and customizable events and user properties that can support additional analysis.
What if we could extend the functionality of Firebase even further? Because Firebase is built on Google Cloud Platform, we can trigger Google Cloud Functions using Google Analytics for Firebase, thereby taking further back-end actions based on user interactions with our mobile apps.
What Are Cloud Functions?
Cloud Functions are part of the Google Cloud Platform (GCP). Cloud Functions let you write and deploy code that responds to events from Google Cloud Services, including Firebase products like Google Analytics for Firebase. (As another use case for Cloud Functions, check out Taha’s post about the integration of Cloud Functions and BigQuery).
What can you do with Cloud Functions?
Cloud Functions allow you follow up on user actions in a variety of ways. Using Firebase conversion event triggers (outlined below), you can use Cloud Functions to:
- send a welcome email when a user completes signup
- send a coupon when a user completes a purchase
- send an SMS confirmation when a user creates a new account
Using Real-time Database Triggers, you could:
- notify users when something interesting happens within the app
From an architecture perspective, you could use Cloud Storage triggers to:
- execute intensive tasks (heavy CPU or networking) in the cloud instead of in the app
Creating Cloud Functions
To create cloud functions, there are two methods:
- Using the Command-Line Tool:
- Using the GCP Console:In this method, you create and deploy the cloud function on the Google Cloud Platform after linking your Firebase Project to it.
What are Analytics Conversion Events?
Conversions are your most important events. You can designate up to 15 events per Firebase project as conversions, in addition to the three default conversions (first_open, in_app_purcase, and ecommerce_purchase). Only events marked as conversion events are currently supported by Cloud Functions. We can specify which events are conversion events in the Events tab of the Firebase console Analytics pane.
A Note on Sunsetting the Google Analytics Services SDKs
Last year, the Google Analytics team started to send some of you a note to let you know that in October 2019 they will begin to sunset the Google Analytics for mobile apps reporting and the Google Analytics Services SDK. Here are the main points you should remember:
- Data collection and processing for such properties will stop on October 31, 2019.
- Reporting access through The Google Analytics UI and API access will remain available for these properties’ historical data until January 31, 2020.
- After the service is fully turned down, these properties will no longer be accessible via the Google Analytics UI or API, and their data will be removed from Google Analytics servers.
My friend Tara Kincade wrote a comprehensive post about this topic, but the main point here, if you are not a Firebase – Google’s integrated app developer platform – user yet, you have to consider the transition to be able to benefit from its solutions best-in-class with new features and capabilities rolling-out continually like Analytics and Cloud Functions that we explored above.
About the Author
Analytics Consultant – Implementation
Marof is a strong proponent of the “Work Smarter, Not Harder” philosophy. Passionate about development, analytics, science and technology, he graduated from Ain Shams University with a BS in Physics and Computer Science and from the Information Technology Institute with a diploma in Software Development. Marof is certified in Google Analytics & Google AdWords Mobile.