Firebase Analytics, and in its latest form, Google Analytics for Firebase, is an extensive analytics solution that enables brands measure relevant KPIs on their app and how their users interact with it. Those key metrics will enable Batch customers to get clear performance data of their campaign, but also better understand the behaviour of users in order to encourage conversion scenarios within the app.

The technical partnership allows you to collect in Firebase your Batch campaign opens in two simple steps : you have to add a little bit of code for the SDK to pick up the utm parameters in your pushs and then add it to your deeplinks or custom payload.

1. Wiring up Batch SDK to Firebase

First, we need to wire up Batch SDK to a small plugin. Its job will be to read Batch's notifications clicks, and extract the right parameters before sending them to Firebase.

Android:

Start by copying the FirebaseBatchIntegration  class to your project. The code can be found here :

https://gist.github.com/benjaminths/df1c71a6c305806a3013661c327913ff

As shown in the BaseActivity  example of the gist, you will have to call FirebaseBatchIntegration.handleIntent in every activity, both in onCreate and onNewIntent.

iOS:

Copy the FirebaseBatchIntegration  class in your project. The code can be found here (Swift 4.2):

https://gist.github.com/benjaminths/d23a018d5ecb9f14918be69d824003ad

Then, as shown in the gist, simply call 

FirebaseBatchIntegration.setup()

in applicationDidFinishLaunchingWithOptions  before Batch.start(withAPIKey:) 

If you call this method after starting Batch, the integration may work incorrectly.

2. Marking your campaigns with Firebase

This plugins will look for an utm_source parameter in your campaigns deeplink or in the custom payload, so you can put your parameter in either one of these. 


Then you should see events coming in your Firebase dashboard as such :


That's it!

Did this answer your question?