SVG

How To Send Data From AppsFlyer to Firebase

In the competitive landscape of mobile applications, leveraging precise, reliable analytics can be the defining factor between success and stagnation. AppsFlyer and Firebase, two powerful tools at the forefront of app analytics and development, combine to create a robust analytical framework, paving the way for a nuanced understanding of user behavior and more effective strategies for user acquisition, engagement, and retention.

AppsFlyer excels in providing detailed attribution data, helping you understand where your users originate. On the other hand, Firebase offers an extensive suite of tools for mobile app development, along with in-depth analytics to track user engagement within your app. Marrying these two can help you see the full picture – from user acquisition to engagement, providing you with valuable data to optimize your marketing strategies and improve your app's overall performance.

This tutorial aims to guide you through the process of sending data from AppsFlyer to Firebase. So, let's dive in. We’ll start with the basics of both technologies.

Understanding the Basics of AppsFlyer and Firebase

Before we dive into the technicalities, it's important to grasp the fundamentals of AppsFlyer and Firebase.

What is AppsFlyer?

AppsFlyer is a leading global mobile attribution and marketing analytics platform that assists app developers, marketers, and brands in tracking and optimizing their user acquisition funnel. The platform provides comprehensive insights into app marketing campaigns, allowing businesses to understand where their users are coming from, how they interact with the app, and how marketing efforts are performing across various channels and campaigns. Offering integrations with over 2,000 ad networks, AppsFlyer is recognized for its robust attribution, deep linking capabilities, and extensive analytics, making it an essential tool in the mobile app industry for driving performance marketing success.

What is Firebase?

Firebase is a versatile platform that empowers developers to build high-quality apps with ease. Whether you're developing a mobile app or a web application, Firebase offers a range of services that simplify the development process such as:

  • Firebase Realtime Databases – With Firebase Realtime Database, you can build apps that synchronize data across devices in real-time. This means that changes made on one device are instantly reflected on other devices. This feature is particularly useful for collaborative apps, chat applications, or any app that requires real-time updates.
  • Firebase Cloud Firestore – A NoSQL database designed to scale better for larger applications. It allows for expressive querying, robust offline support, and real-time updates and is designed to scale to support even the largest of apps.
  • Firebase Cloud Storage – With Firebase Storage, you can securely store and retrieve user-generated content such as images, videos, and documents. This feature is particularly useful for apps that rely on user-generated content, such as social media platforms or file-sharing apps.
  • Firebase Analytics - A free and unlimited analytics solution that offers insights into app usage and user engagement. It helps developers understand how people use their iOS or Android apps, and it provides insight into app user behavior, thus assisting in informed decision-making regarding app marketing and performance optimization.

Firebase also includes services for more use cases such as push notifications, user authentication, serverless cloud functions, machine learning, etc.

Why integrate AppsFlyer with Firebase?

AppsFlyer and Firebase are two powerful tools that play a crucial role in the success of mobile apps. While AppsFlyer focuses on tracking and analytics, Firebase provides a comprehensive platform for building and managing apps. By leveraging the capabilities of both platforms, app developers and marketers can gain valuable insights and create exceptional user experiences.

While the integration requires a good bit of effort, it enables a number of use cases. To name a few, you can implement post-processing for your AppsFlyer events for analytics tasks such as segmentation, personalization, or retention planning, you can send AppsFlyer events to Firebase Analytics without duplicating the events, you may perform A/B testing based on AppsFlyer events, you can forward events to some other services, you can send push notifications to customers based on specific events that occur across devices (e.g. purchase confirmation). You can also send data to GoogleAds using their APIs to enable retargeting customers tracked by AppsFlyer and forwarding event data to BigQuery for further data processing.

Setting up your AppsFlyer account

If you haven’t set up an AppsFlyer account already, follow these instructions:

Creating an AppsFlyer account

1. Visit the AppsFlyer website to sign up.

2. Fill in the required information, including your name, email address, and company details.

3. Agree to the terms and conditions, and click "Sign Up" to create your account.

Once you have successfully created your AppsFlyer account, you will gain access to a wide range of features and tools that can help you track and analyze the performance of your mobile apps.

Navigating the AppsFlyer dashboard

Once your account is created, you will be redirected to the AppsFlyer dashboard. The dashboard provides an overview of your app performance, including key metrics and campaign data.

Take some time to familiarize yourself with the different sections and navigation options available in the dashboard. The main sections include:

  • Overview: This section provides a high-level summary of your app's performance, including the number of installs, revenue, and engagement metrics.
  • Dashboards: There are multiple dashboards available to you such as the Retention dashboard to analyze user retention rates and understand how well your app is retaining users over time. The Protect360 dashboard helps you detect and prevent fraudulent activities, ensuring that your marketing budget is spent on genuine users. Engagement dashboards help measure user engagement metrics such as sessions, screen views, and in-app events to gain insights into user behavior.
  • Reports: You can export and download various reports here.
  • Configuration: You can configure partner integration from the partner marketplace, change app settings, and set up alerts and validation rules.
  • Integration: This is the section important for you for the purpose of this tutorial. Here you can explore options to integrate external services via APIs or AppsFlyer SDKs.

Setting Up Your Firebase Account

Now that you have your AppsFlyer account set up, let's move on to creating a Firebase account:

Creating a Firebase Account

1. Go to the Firebase website and click on the "Get Started" button.

2. Sign in with your Google account

3. Follow the on-screen instructions to create your Firebase account.

Once you have signed in with your Google account, Firebase will guide you through the process of creating your account. This includes providing some basic information, such as your name and email address, and agreeing to the terms and conditions.

Understanding the Firebase Console

Once you have created your Firebase account, you will be taken to the Firebase console.

The Firebase console is your central hub for managing all aspects of your Firebase projects. It provides a comprehensive and intuitive interface that allows you to easily navigate through the different services and tools offered by Firebase.

From the console, you can access a wide range of features, such as the Firebase Authentication service, which allows you to easily add user authentication to your app, and the Firebase Realtime Database, which provides a NoSQL cloud database for storing and syncing data in real-time.

In addition to managing your Firebase projects, the console also allows you to configure settings for your app. This includes setting up custom domains, enabling push notifications, and managing app permissions.

Sending data from AppsFlyer to Firebase Realtime Database

There is no official integration between AppsFlyer and Firebase. So, we need to either use third-party tools for this integration (e.g. RudderStack’s easy AppsFlyer to Firebase integration) or build a custom integration. Here’s how we can build a custom integration:

  1. Use AppsFlyer Push API to send data from AppsFlyer to one of the Firebase database services such as Firebase Realtime Database, Firebase Cloud Store, Firebase Storage, etc.
  2. Write a server-side program in your favorite framework/language such as Node.js, Java, Go, or Python, and use the Firebase Admin SDK to track Firebase database changes
  3. Once new event data is available in the Firebase database, transform it to send it to other Firebase services such as Firebase Analytics or Firebase Cloud Messaging or other external services such as Google Ads or Google Analytics using their APIs

For the purpose of this tutorial, we will choose Firebase Realtime Database to store events as it provides REST APIs to add data into the database and it is the easiest to integrate among other databases Firebase provides.

Instead of the Push API, we could use AppsFlyer Pull APIs to fetch raw data of AppsFlyer events on a scheduled interval, but that wouldn’t be suitable for real-time use cases.

Overall process will include 3 steps: create a database, configure the AppsFlyer Push API, and finally track database changes. Let’s see how to do that.

Create Firebase Realtime Database

Firebase Realtime Database has a Free plan and can be set up easily by following these steps:

  1. Go to the Firebase console: https://console.firebase.google.com/.
  2. Click the Create project button.
  3. Enter a project name and click the Create button.
  4. Enable the Firebase Realtime Database service.
  5. Click the Create database button.
  6. Select a location for your database and click the Create button.
  7. Your Firebase Realtime Database will be created.

Note down the database endpoint you get here. It is usually in the form of https://[PROJECT_ID].firebaseio.com. It will be required later. Once your Firebase Realtime Database is created, you can start storing data in it.

Configure AppsFlyer Push API to send data to Firebase Realtime Database

In order to send events from AppsFlyer to Firebase Realtime Database, follow these steps:

  1. In the AppsFlyer dashboard, go to Integration -> API Access -> Push API
  2. Add the endpoint for Firebase Realtime Database https://[PROJECT_ID].firebaseio.com/events.json where PROJECT_ID is the project ID of your Firebase project and events is the name we picked for the node where we want to store the data, you could choose any other name as well. The final url must have .json at the end and is created by adding /events.json to the Firebase Realtime Database url https://[PROJECT_ID].firebaseio.com.
  3. Check the events from the list given in the dashboard that you want to send to Firebase
  4. Click “Send test” and then verify if the data reached your Firebase realtime database or not
  5. On successful test, you can save these Push API configurations

Now your AppsFlyer events will be streamed to Firebase without any interaction required from your end.

Make sure to read the official guide to using the AppsFlyer Push API. Learn more about Firebase Realtime Databases REST APIs.

With these settings in place, you should now start seeing the AppsFlyer data within your Firebase project, allowing you to leverage the powerful analytics and app management features offered by both platforms. In the next section, we will take a quick peek into how you might leverage this data.

Track Firebase Realtime Database changes for further integrations

Firebase Realtime Database provides some extensions which can be used to perform specific actions on the data stored in the database.

If you need more flexibility in operating on the Firebase Realtime Database content, you can create your own program using the Firebase Admin SDK for your favorite server-side framework/language such as Node.js, Java, Python, Go, etc. The SDK provides event listeners that can trigger the code you want to execute when a new record is added to Firebase Realtime Database. You can use this functionality for various use cases such as processing your AppsFlyer events for analytics tasks such as segmentation or personalization or retention planning, sending events to Firebase Analytics, performing A/B testing, forwarding events to some other service, sending a notification/email to a customer based on specific events that occur across devices (e.g. purchase confirmation). If you want to send this data to Firebase Analytics you can use the logEvent method of the firebase analytics SDK to send events to Firebase Analytics. This is how the code will look in Node.js:

JAVASCRIPT
const firebase = require("firebase-admin");
const analytics = admin.analytics();
// Initialize the Firebase Admin SDK.
// Note: Firebase Admin SDK has more privileges than Firebase SDK
firebase.initializeApp();
// Listen for new records being created.
firebase.database().ref("/events").on("child_added", (snapshot) => {
console.log("New record created:", snapshot.val());
// Any operation you want to perform based on this new record, you can do here e.g. sending event data to Firebase Analytics
analytics.logEvent("new_apps_flyer_event", snapshot.val());
});

This is just a simple overview of what integration between AppsFlyer and Firebase will look like. There might be more steps involved for a real-world application such as authenticating your Firebase account with a Google Cloud Service account, specifying the database url, specifying the data node, etc. Follow Firebase Realtime Database documentation to learn more.

Conclusion

Congratulations! If you have followed the steps correctly, you have successfully integrated AppsFlyer with Firebase. Now, as new events are added to your AppsFlyer account, they will automatically be pushed to your Firebase Realtime Database and tracked for further processing

While Firebase provides an array of tools for developing high-quality apps, integrating it with AppsFlyer's robust tracking and marketing analytics platform can create an even more powerful tool for understanding and enhancing your app's performance.

Remember, integration will only get you so far. It's crucial to regularly monitor your app's performance, analyze the collected data, and use these insights to make informed decisions and continually optimize your strategies.

So, keep experimenting, keep optimizing, and take your app to new heights! Check out RudderStack's Appsflyer to Firebase integration.

Don't want to go through the pain of direct integration? RudderStack's AppsFlyer integration makes it easy to send data from AppsFlyer to Firebase.