activitree / meteor-push

Meteor Push Notifications for Cordova and Web/PWA with Firebase (FCM).
MIT License
27 stars 19 forks source link

Track notifications analytics #20

Closed AleF1 closed 4 years ago

AleF1 commented 4 years ago

Is there any way to track notifications in the firebase console?

paulincai commented 4 years ago

Hi @AleF1, you have some basic API reporting here (success/fail): https://console.cloud.google.com/apis/api/fcm.googleapis.com/overview?project=your_project.

For more detailed analytics, I guess you could use this: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidfcmoptions which as I can see in the project is only half implemented (both IOS and Android). It exists in the final notification constructor but it is missing from the notification data validation which means...if you need it, it should be pretty easy to get it running with a very small update. Which one cover your present needs: Google Console or the Analytics field as described in the second link?

AleF1 commented 4 years ago

Thanks for the quick answer @paulincai. The second link is what I'm looking for but I do have an analytics label on push startup. It may not be doing anything cause there's no validation... No clue tho.

paulincai commented 4 years ago

Ok, that should be passed to the final notification. Look at defaults.analyticsLabel

fcm_options: {
        analytics_label: mongoNote.analyticsLabel || defaults.analyticsLabel,
        image: mongoNote.imageUrl || defaults.imageUrl
      }

So, if you have a label set in your server side startup file and if you enable debugging, you should see that value in your server console when you send a notification.