5

I integrated the Google Analytics Tracker.

I used the following code to send a track for the welcome screen:

   Tracker tracker = ((AnalyticsSampleApp) this.getApplication()).getTracker(
            AnalyticsSampleApp.TrackerName.APP_TRACKER);

    // Enable Advertising Features.
    tracker.enableAdvertisingIdCollection(true);

    // Set screen name.
    tracker.setScreenName("Welcome Page.");

    // Send a screen view.
    tracker.send(new HitBuilders.AppViewBuilder().build());

How can I know if tracking is working.

Note: I don't have an access to the google analytics account.

Should it send messages to log cat? can see any related messages!

hasan
  • 23,815
  • 10
  • 63
  • 101

2 Answers2

7

This is an old question, but right now getLogger() method is deprecated. Another way to check if analytics is working could be achieved using adb command.

To enable debug logging on a device run:

adb shell setprop log.tag.GAv4 DEBUG
adb logcat -s GAv4
stkent
  • 19,772
  • 14
  • 85
  • 111
Chema Rubio
  • 91
  • 1
  • 5
  • 2
    Not only getLogger() method is deprecated but the whole Logger interface has been deprecated and we all should remove this setup from our apps and use adb command in this post to enable GA logs inside the console. Reference is here https://developers.google.com/android/reference/com/google/android/gms/analytics/Logger – Stoycho Andreev May 15 '17 at 14:20
4

It can print a bunch of stuff to logcat, you need to configure the log level, e.g.

GoogleAnalytics.getInstance(this).getLogger().setLogLevel(LogLevel.VERBOSE);

For true end-to-end testing create your own Google Analytics account and hard-code your own property ID. The real-time dashboards will show you your test activity.

orip
  • 73,323
  • 21
  • 116
  • 148