Tracking Notification Impressions
The application needs to notify the SDK if a push from the MoEngage Platform is received via Firebase Cloud Messaging(FCM). SDK provides a helper API isFromMoEngagePlatform() to check whether push is received from the MoEngage Platform or not. Use this API to check if the received push is from the MoEngage Platform and call logNotificationReceived() to track notification impressions.Tracking Notification Clicks
After the notification is clicked application needs to notify the SDK that a notification is clicked for the SDK to track notification clicks. For SDK to track notification clicks and user sessions accurately, ensure:- The Push payload received from FCM is added as extras to the Pending intent
- The logNotificationClick() API is called from onCreate() of your Activity which is inflated on notification click.
Background Update Template (Manual Approach)
- SDK version: The self-handled notification check is supported starting from Android SDK version 14.06.00.
- Payload information: For more information on the payload structure and available keys, refer to Background Update Template.
If you are using a custom
PushMessageListener,MoEngage recommends using the SDK Callback approach where impressions are tracked automatically. Refer to the Callback Customization section for more details.Callback for push delivered by Push Amp
Push-Amp notification is not delivered via FCM, it is delivered directly via MoEngage. You need to set up a callback for receiving payload for messages/campaigns.Steps:
- Setup a callback for notification received. For more information, refer to the notification received callback documentation.
- Mark notification as not required. This step is important, if not implemented correctly end-user might end up with two notifications. For more information, refer to the notification received callback documentation.