Felipezad
Felipezad

Reputation: 35

Tracking any Notification click on Android

I'm in the process of enhancing a legacy app that receives various types of notifications, such as those from Firebase, third-party software, and even some that we create ourselves.

The data analytics team has asked me to track every click on these notifications, which got me thinking. I know about using PendingIntent actions, but our push notifications already link to an Activity with a PendingIntent. So I'm a bit unsure about how to also capture those clicks for tracking purposes.

I've come across suggestions about creating a Broadcast to capture actions, but unfortunately, that didn’t quite work out for me.

Is there a way to track clicks on any notifications that come into our app, whether they’re local or remote? The main goal is to add analytics to see if users are engaging with those notifications.

Another idea I had was to check within each Activity to see if it was opened from a push notification. However, I'm concerned about how practical that would be, especially since I'd like to avoid major code changes — going into every single Activity sounds like a lot of work! Plus, I'd need a way to identify if the Activity was opened from either a local notification created by us or from third-party sources, which I'm not entirely sure how to do.

Any thoughts or suggestions?

I have gone through this documentation.

Upvotes: 0

Views: 35

Answers (0)

Related Questions