Skip to main content
All Collections2. Define push_token to mobile analytics
Sending event with push_token: Firebase Analytics SDK + Firebase Cloud Messaging SDK (Android)
Sending event with push_token: Firebase Analytics SDK + Firebase Cloud Messaging SDK (Android)
K
Written by Kirill Slobodianiuk
Updated over a year ago

💡 nGrow.ai is a no-SDK solution, so the integration part is easy-peasy. But we’ll need a little bit of your app developer’s attention to do things in this guide (about 30 mins). That’s it.


Goals

The goal of this guide is to set up:

  • basic push notifications handling via Firebase Cloud Messaging SDK

  • set up a callback for sending registration_id (same as push token in Firebase Cloud Messaging system) to Firebase Analytics as an event with event property

Prerequisites

It is expected that you’ve already implemented:


💡 Sometimes there are problems on android that the icon is not displayed. This guide will help you troubleshoot these issues.


Sending registration_id as an event property


⚠️ This is an important mandatory part


  1. Implement logging the custom event push_token with custom event properties. If you don't know, how to send custom events, please refer to this instruction.

    1. There is a bit tricky part with sending push tokens (registration id in Firebase). The thing is that there is a limit of 100 characters for any string event property, but the registration id length is ~163 chars. So we suggest splitting the registration id into two strings of 100 chars and the rest respectively, and sending them in two event properties push_token_0 and push_token_1 within the same event.

    2. So the final setup of the event would be:

      event_name: push_token 
      event_properties:
      push_token_0: “fVB5-GsfONYTmjsOX6POeS:APA91bGOokpBTI_aAO_JybIMfJ8WCPX_77EWVqzOlmsTm6GaUngqRf-hu_ZMXS9JptSOqBJ0YxOG”,
      push_token_1: “IhnUwZAetYELraJkvzGOJxQCksefcJLsg_1zPi7LYKWqfQ35qLc2CNwb6TFddGv9”

  2. We strongly recommend logging the push_token event on EVERY app start. To retrieve the current token, you need to call FirebaseMessaging.getInstance().getToken() method.

  3. Make sure that you have linked Firebase and BigQuery according to this instruction.

Did this answer your question?