Search code examples
firebasegoogle-bigqueryfirebase-cloud-messaging

How do I import segments from BigQuery into Firebase?


Firebase's Import Segments documentation doesn't really fill in all the gaps of what I see in Firebase or BigQuery.

To me, it implies that I can build queries using Firebase events in order to create segments in BigQuery and then import them back into Firebase to use as Audiences (for cloud messaging). My problem is that I don't see exactly how that works.

Can anyone explain exactly how that works (if it's actually possible). And does it really require explicitly logging the Firebase Installation ID? Shouldn't it use an identifier that's already logged in the Firebase ecosystem?

--- Edit with additional info --- I currently have the Firebase/BigQuery integration setup w/ Google Analytics and Imported Segments options selected. I then created a segment in the SegmentMetadata table in BQ's firebase_imported_segments db and I see that it populated in Firebase's Imported Segments dropdown.

So, more specifically, using the Firebase Events that come through Google Analytics into BigQuery, how do I populate the segment? The documentation says to use the instance_id in the SegmentMembership table but that is not part of the Firebase Events metadata. user_pseudo_id is the only identifier that I'm aware of.

And secondly, if I can populate the segment, where does it show up in Firebase? Will it just show up in the Audiences section because it doesn't right now. (Maybe because it's empty or there's a delay?)


Solution

  • In this case instance_id is not same as user_pseudo_id (a bit confusing though).

    Print your instance id (in this case installation id) to mobile app log. Then you can easily grep it.

    If you have a requirement to identify particular installations of your app, you can do so by retrieving the Firebase installation ID. For example, to perform testing during Firebase In-App Messaging development, you can identify and target the correct test device using its Firebase installation ID.

    To retrieve a Firebase installation ID:

    https://firebase.google.com/docs/projects/manage-installations#retrieve_client_identifiers