I am using Google Analytics in my apps and it works correcly. However, if I have, lets say, 100 active users daily, and then I send a notification, I have a peak of 1000 connected users counted as "active".
I don't know if there is an easy way to prevent these users to count as active. Most of them will not open the notification and I don't want them to count as active. I want to count only the users that open the app, not all who received the notification.
I am using "body" field in the notification that I send, and in the app I create a custom notification.
Is it any way to remove these "active" users?
Thank you very much!
With easy-to-use SDKs and reports designed with app developers in mind, Google Analytics for Mobile Apps enables you to: Understand the number of users in your app, their characteristics, and where they come from. Measure what actions your users are taking. Measure in-app payments and revenue.
Firebase, we see that they have the same data model — one that depicts user interactions as events. That's why both platforms also share the same implementation process — the only difference between Firebase Analytics and Google Analytics in this regard lies in where you first set up your Android and iOS data streams.
If you need to deactivate Analytics collection permanently in a version of your app, set FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES (Boolean) in your app's Info.
Whenever your app receives new Notification, Application OnCreate()
method will be invoked.
Not only the Notification, even when you subscribe to system events like ACCESS_WIFI_STATE, ACCESS_NETWORK_STATE, RECEIVE_SMS, RECEIVE_BOOT_COMPLETED.. Application OnCreate() will be invoked.
So inside your Application OnCreate()
, don't make any Google Analytics related calls.
This will initialize your GA and start the event tracking.
Remove Google Analytics related codes inside your Application OnCreate()
, to prevent unwanted event tracking.
Update:
https://developers.google.com/analytics/devguides/collection/android/v4/advanced
getInstance(Context context)
Gets the GoogleAnalytics instance, creating it when necessary.
Multiple way of implementation around this; I recommend you the following way to solve your problem. As document says, prepare the GoogleAnalytics instance, only when it is needed.
Keep the below code inside your Application class, so that your mTracker
instance will alive across your application lifecycle.
// Inside Application class
private Tracker mTracker = null;
public synchronized Tracker getDefaultTracker() {
if (mTracker == null) {
// Prepare the GoogleAnalytics instance, only when it is needed.
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
mTracker = analytics.newTracker(Config.GA_TRACKING_ID);
mTracker.enableAutoActivityTracking(true);
mTracker.enableExceptionReporting(true);
mTracker.setSessionTimeout(SESSION_TIMEOUT);
}
return mTracker;
}
Hope this would help you..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With