05.12.2022 | Nikolay Valiotti
In-House vs. Outsource Data Analytics: What to Bet On in a Crisis?
Developing reliable and high-quality mobile and web applications requires a lot of dedication and, more importantly, a powerful and feature-rich development platform. Firebase, provided by Google, is one platform that has gained a strong foothold among developers worldwide. With this platform, you can quickly develop high-quality applications, attract new users, and increase revenue. The platform offers several integrated features, such as a mobile app server, mobile analytics, app promotion, and monetization tools that can be used individually or in any combination.
Firebase allows you to collect event data from your mobile apps and provides functionality for their analytics. But what if this functionality is not enough? What if you have several data sources (for instance, not only Firebase) from which you want to aggregate information (i.e., import data) and build custom mobile analytics?
In this guide, we will show you how to set up a custom mobile analytics environment for your data using popular tools.
To analyse data from Firebase, a user must first import data from BigQuery:
The number 467 represents the number of days for which there is event data.
Now you have a repository in BigQuery with data from Firebase; you can work with its different features and build custom reports for business insights. To do this, you can use two types of tools – on-premise or cloud.
Let’s look at the first type, on-premise, and briefly describe how to deploy a tool like Metabase for data analysis. Let’s deploy Metabase using Docker (for the example, it is assumed that Ubuntu 22.04 LTS is the working system):
sudo docker pull metabase/metabase:latest
sudo docker run -d -p 3000:3000 --name metabase metabase/metabase
docker logs -f metabase
In our case, we need to configure the connection to BigQuery.
In the Service account JSON file field, upload the key in JSON format, which can be created in the Keys tab on the settings page of your service account in Google Cloud.
4. Allow/deny Metabase to collect tool usage information and complete the setup by selecting Finish.
5. The screen will inform you that the setup is complete. Select Take me to Metabase (you can also subscribe to the newsletter to learn about new features, get deeper insights, etc. while you are there!).
9. It’s worth noting that the above method has a drawback: Metabase ships with an embedded H2 database that uses the file systems to store its own application data. This means that if you remove the container, you’ll lose your Metabase app data (your questions, dashboards, collections, and so on).
If you want to run Metabase in production, you’ll need to store your app data in a production-ready database. You can read about how to run the production version of Metabase here in the section “Production installation”. If you have already set up the production database, you can read here how to migrate data.
10. After setting up Metabase, you will be taken to a workspace for managing data where you can analyze your data and build custom reports.
11. For example, you can view the contents of each table and perform quick mobile analytics without using SQL:
12. A similar result can be obtained if you click on the top right + New and select Question:
13. You can also build a data visualization based on a SQL query:
14. To create a dashboard, select +New, then Dashboard.
There are cloud solutions for those who do not want to or cannot deploy the tool on their machine. The same Metabase can be used in the cloud, but you will have to pay for it (flat-rate pricing for 5/10 users; although there is a 14-day trial period):
However, there are other cloud tools and platforms that have free plans for users, such as Preset Cloud (which, by the way, has an on-premise counterpart–Apache Superset).
Let’s see how to connect data from BigQuery to Preset Cloud.
Since there is a separate table for each day in the data warehouse, it can be inconvenient to write queries manually specifying table names. Table suffixes come to our aid, which can be accessed via TABLESUFFIX.
Let’s take a simple example. The following query will return all dates for events from the last week:
SELECT DISTINCT event_date FROM `analytics_< ... >` . `events_*` WHERE TABLESUFFIX BETWEEN FORMAT_DATETIME ( '%Y%m%d' , DATE_SUB ( CURRENT_DATE (), INTERVAL 7 DAY )) AND FORMAT_DATETIME ( '%Y%m%d' , CURRENT_DATE ()) ORDER BY event_date DESC
We can check the request, for example, in Preset Cloud:
You can see that there are only six results – the table with data for 20.06 has not yet been created.
The same process can be done in Metabase as well:
For more constructive mobile analytics and business intelligence, data from Firebase alone may not be enough. But you can connect additional data sources to build merged reports and unlock business intelligence capabilities.
For example, if you have an active Facebook ad account, you can use Airbyte to access and export data on ad insights to your storage. Read about how to do this here.
It is worth noting that collecting data from different sources and storing them in one database is recommended for most use cases.
You need this guide, because it includes:
Turn it on to get exclusive guide on modern data stack
Emails suck. This newsletter doesn’t
Subscribe to the newsletter and get the most useful guide on modern data stack
You will also receive other useful materials on data analysis hacks with case examples from our company.