How to send in-app subscription events to Firebase, Google Analytics, and Google Ads
Tags: firebase, subscriptions, tutorial
Published: 2022-10-16 15:56:24

Google provides massive user acquisition opportunities for subscription apps. Using [Google’s App Campaigns](https://qonversion.io/blog/how-to-best-promote-your-app-google-app-campaigns/) you can promote your app across Google Search, Google Play Store, YouTube, Discover on Google Search, and the Google Display Network. Besides user acquisition, Google’s Firebase and Google Analytics provide a set of tools to manage and grow your product. This includes advanced A/B testing, push notifications, and analytics. 

But to be able to truly leverage Google’s ecosystem, a subscription app needs to send accurate in-app subscription data to Google, including data on subscription renewals and trial-to-paid conversions. 

For example, though Google’s machine learning does most bidding and performance optimization in Google App Campaigns, it still needs correct revenue data to do so effectively. 

This article covers how to set up conversion tracking for subscription apps with Firebase. The data from Firebase can be used everywhere on Google’s platform, from A/B testing in Firebase to campaign optimization on Google’s App Campaigns. Additionally, we will take a closer look at how conversion tracking affects your Google App Campaigns.

## Google Analytics for Firebase SDK

[Firebase Google Analytics](https://qonversion.io/blog/how-to-send-in-app-subscription-events-to-firebase-google-analytics-and-google-ads/) is a free app measurement solution that provides insights on app usage, user acquisition, and engagement. Google recommends using this solution as it is most accurate, so if you’re using Google Ads SDK, please consider switching your tool to Firebase. 

When SDK is in place, you’ll automatically receive a number of events that could be used as conversion [events](https://support.google.com/firebase/answer/9234069?hl=en) (goals) for your Google Ads campaigns.

However, there are just a few predefined events that make sense for subscription apps: 

`app_store_subscription_renew` 
`app_store_subscription_convert`
`app_store_subscription_event_started` (Android only) 
`app_store_refund` (Android only)
`in_app_purchase`

As you see, the number of subscription events to track is very limited. 

## Firebase Integration: How to send subscription events to Firebase and Google Analytics 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w3zm66hexk5soq3zar7.png)

Qonversion enriches Firebase data with subscription revenue events, including purchases, trial conversions, subscription renewals, and even refunds. This allows you to match your users’ behaviour with their payment history in Firebase, empowering your user acquisition and product decisions. Qonversion sends events server-side, which means that renewals and cancellations are sent to Google Analytics in real-time, even if the customer doesn’t open the app. And even more importantly,  implementation takes about 20 minutes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3c4v169xzffvtg9uczo.png)

Firebase track install, In-app purchases and subscriptions events iOS, Android.

To send subscription events to Firebase, [you need](https://documentation.qonversion.io/docs/firebase):

- Set up the [Google Analytics for Firebase SDK ](https://firebase.google.com/docs/analytics/get-started)
- Set up [Qonversion SDK  ](https://documentation.qonversion.io/docs/install-sdk)
- Send firebaseAppInstanceId to Qonversion using [User Properties](https://documentation.qonversion.io/docs/user-properties).

`if let appInstanceID = Analytics.appInstanceID() {
    Qonversion.setProperty(.firebaseAppInstanceId, value: appInstanceID)
}`

4.  Configure the [Firebase Integration ](https://qonversion.io/blog/how-to-send-in-app-subscription-events-to-firebase-google-analytics-and-google-ads/)
4.1. Copy your Firebase App ID and Measurement Protocol API secret from the [Google Analytics Console](https://analytics.google.com/analytics): Admin → Data Streams → Select existing or create a new stream for your App.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvw8e5nsrvo2ffoa688o.png)

4.2. Navigate to the Tools → Integrations section in your Qonversion account.

4.3. Choose your platform (IOS or Android) and click the Add new + button and select Firebase.

4.4. Provide the API Secret and App ID copied in the first step to the corresponding fields.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lg5debko0ie9j5d94ktq.png)

That’s it! From now on, all subscription events will be visible in Firebase. 

## How to link Firebase Google Analytics to Google Ads

This step is necessary if you’d like to optimize your Google Ad campaigns based on Firebase conversion tracking events. 

To successful setup, you need to [perform four steps](https://documentation.qonversion.io/docs/google-ads):

1. Firebase => Project Settings
2. Click Integrations tab 
3. Link Google Ads to Firebase project
4. Enable events as conversions: On the Events tab, in the row for Qonversion events, turn on the switch in the Mark as conversion column. You can have a maximum of 15 conversion events per app in Firebase. Once an event has been enabled as a conversion, it is available in Attribution > Conversion Events. Attribution reporting begins for that event at the time you enable it as a conversion.

The data from Qonversion Firebase Integration unlocks new capabilities for Google App Campaign optimization for subscription apps. Let’s take a deeper look.

## What Google App Campaigns are

Google App campaigns are user acquisition channels that allow you to promote your app within the Google Network – on Youtube, Discover, Search, Google Play, etc. Unlike most Google Ads campaigns, you don’t need to create individual ads for each campaign. You only need to upload the set of assets: text, images, videos, and a starting bid and budget. Google will automatically design different ad variations across different formats and networks. Google Ads will test different combinations and show better-performing ads more often, with no extra work on your part.

There are three main types of Google App Campaigns: 

1. Google App Campaigns for installs. 
2. Google App Campaigns for pre-registrations. 
3. Google App Campaigns for engagement. 

The insights of this article could be the most useful for Google App Campaigns for Engagement and Google App Campaigns for Installs optimization. You can check more details on [Google App Campaigns](https://qonversion.io/blog/how-to-best-promote-your-app-google-app-campaigns/) here.

## How to optimize Google Ad based on Firebase conversion events data

## Google App Campaigns optimization by conversion event

You can set the primary conversion event for your Google App Campaign. Google Ads will automatically use this data to learn to optimize your ads, using this parameter to get you the best number of conversions and to optimize your set cost-per-action bid.

1. Open the [settings](https://support.google.com/google-ads/answer/9234102?hl=en-GB&ref_topic=11069497) of your Google App Campaign.
2. Choose which in-app actions (conversion event) you want to optimize your campaign for, and then enter a target cost per this action (target CPA).

That’s it! Now Google Ads has enough data to learn to optimize your campaign by specific metrics: trial to subscription, or subscription to renew, etc. The fill list of metrics that you could optimize your campaigns for is [here](https://documentation.qonversion.io/docs/integrations-overview).

## Google App Campaigns optimization by the audience 

You can [create audience segments in Firebase](https://support.google.com/google-ads/answer/6398643) using any combination of events and user properties (for instance, people from UK that subscribed to your app for the first time). 

Then, you could apply your segments for a particular App Campaign. Segments based on mobile app data can be targeted by Search, Display, and Video campaigns.

1. [Create a segment in Firebase.](https://support.google.com/google-ads/answer/6398643)
2. Make sure that your Firebase account is linked to Google Ads.
3. Open the [settings](https://support.google.com/google-ads/answer/9234102?hl=en-GB&ref_topic=11069497) of your Google App Campaign.
4. Choose the Target Audience Segment. 

That’s it! Now Google Ads has enough data to lern to optimize your campaign for the specific audience – whether they are new or returning users, or people from specific territory. 

## Conclusion

In this article, we explored how [Qonversion Firebase Integration](https://qonversion.io/blog/how-to-send-in-app-subscription-events-to-firebase-google-analytics-and-google-ads/) allows you to enrich Firebase data and improve the strategy of your user acquisition campaigns. In the following article, we’ll dive deeper into how this integration enables you to attribute user acquisition costs within other [Ad Networks](https://firebase.google.com/products/analytics/partners) outside Google – AdColony, IronSource, Vungle, and others.