Search code examples
androidgoogle-analyticsgoogle-analytics-firebase

Android - Google Analytics V4 event sent but not shown


I want to integrate Google Analytics SDK V4 in my app but I have a problem sending events. I integrated the SDK and generated the configuration file as indicated on the offical documentation. I integrated the conf file on my project, set my build.gradle file, added the AnalyticsService to my Manifest and initialized Google Analytics in my application class:

synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        mTracker = analytics.newTracker(R.xml.global_tracker);
    }
    return mTracker;
}

The R.xml.global_tracker is generated at build and only contains the string ga_trackingId.

When I try to sent events, I can see on the logcat they are sent:

09-19 11:04:29.167 com.myapp.mypackage.debug I/GAv4: Google Analytics 9.0.80 is starting up. To enable debug logging on a device run:
                                                          adb shell setprop log.tag.GAv4 DEBUG
                                                          adb logcat -s GAv4
09-19 11:04:29.207 com.myapp.mypackage.debug W/GAv4: AnalyticsReceiver is not registered or is disabled. Register the receiver for reliable dispatching on non-Google Play devices. See url for instructions.
09-19 11:04:29.227 com.myapp.mypackage.debug W/GAv4: CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See url for instructions.
09-19 11:04:29.737 com.myapp.mypackage.debug D/GAv4: Sending first hit to property: UA-XXXXXXXX-2
09-19 11:04:29.737 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275869721, _s=0, _v=ma9.0.80, a=1185092937, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=Search, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, sr=800x1280, t=screenview, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:04:30.148 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery
09-19 11:05:49.235 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275949229, _s=1, _v=ma9.0.80, a=1185092938, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=Search, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, ea=CustomerAccount, ec=Search, sr=800x1280, t=event, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:05:49.425 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery
09-19 11:05:49.435 com.myapp.mypackage.debug D/GAv4: Hit delivery requested: ht=1474275949372, _s=2, _v=ma9.0.80, a=1185092938, aid=com.myapp.mypackage.debug, an=MyApp, av=1.7-DEBUG, cd=UserAccount.LoggedOut, cid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, sr=800x1280, t=screenview, tid=UA-XXXXXXXX-2, ul=fr-fr, v=1
09-19 11:05:49.455 com.myapp.mypackage.debug D/GAv4: Hit sent to the device AnalyticsService for delivery

But I never see them on the Developer console. When I go on Analytics API on my console, I see "There is no data for this API in this time span". I did my tests friday and event after more than 48h, they don't appear. Also, I see this warning on the Analytics API console:

This API is enabled, but you can't use it in your project until you create credentials. Click "Go to Credentials" to do this now (strongly recommended). Go to Credentials Overview Quotas

If I go to the Credentials Overview, I can see the key "Android key (auto created by Google Service)" which correspond to the key in my google-services.json, so I don't understand why the warning is here.

Can you see where the problem comes from? I searched a lot but was enable to find a response to it.

Thanks!


Solution

  • So apparently, I wasn't looking at the good place. I thought the analytics reports could be seen on the dev console, in Analytics API, but thanks to ZShock, I know they are on analytics.google.com. It isn't written anywhere on the official documentation, so it's pretty disturbing for new users...