Integrate with Firebase
If you're using the Firebase SDK alongside the justtrack SDK, you can use the justtrack SDK to send a user's Firebase App Instance ID to the justtrack backend. Later, the justtrack backend can forward events to Firebase, allowing you to measure events happening outside your app. To enable this, the justtrack backend needs the user's Firebase App Instance ID.
We provide two approaches for integrating Firebase SDK with justtrack SDK.
Before you begin
Please review the following compatibility matrix to make sure you're using compatible versions:
justtrack SDK | Firebase Adapter | Firebase BOM |
---|---|---|
6.0.0+ | 1.x | 22.x |
Option 1: Provide Firebase App Instance ID directly
// Set the Firebase App Instance ID after initializing the justtrack SDK
sdk.setFirebaseAppInstanceId("... provide user's Firebase app instance ID here")
Option 2: Integrate Firebase adapter
First, add the adapter dependency to your package manager:
npm install justtrack-adapter-firebase --save
Then, initialize the adapter, and integrate it with the justtrack SDK:
import { registerAdapter as registerFirebaseAdapter } from 'justtrack-adapter-firebase';
// Register the adapter after initializing the justtrack SDK
registerFirebaseAdapter();