8

I've been working on integrating Google Analytics v4 into my application. I've followed this : https://developers.google.com/analytics/devguides/collection/android/v4/ however, my analytics dashboard isn't displaying any data.

Here is how I've set it up in my application file:

private static final String PROPERTY_ID = "UA-*******-*";

public enum TrackerName {
    APP_TRACKER, // Tracker used only in this app.
    GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking.
    ECOMMERCE_TRACKER, // Tracker used by all ecommerce transactions from a company.
 }


public synchronized Tracker getTracker(TrackerName trackerId) {

    if (!mTrackers.containsKey(trackerId)) {

        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID)
        :(trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker)
        : analytics.newTracker(R.xml.ecommerce);
        mTrackers.put(trackerId, t);

    }
    return mTrackers.get(trackerId);
}

Here is my global config file:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="TypographyDashes">

    <!-- the Local LogLevel for Analytics -->
    <string name="ga_logLevel">verbose</string>

    <!-- how often the dispatcher should fire -->
    <integer name="ga_dispatchPeriod">30</integer>

    <!-- Treat events as test events and don't send to google -->
    <bool name="ga_dryRun">false</bool>

    <integer name="ga_sessionTimeout">300</integer>

    <!-- The apps Analytics Tracking Id -->
    <string name="ga_trackingId">UA-*******-*</string>

    <!-- The screen names that will appear in reports -->
    <screenName name="com.purpledecks.bottomsup.fragments.frag1">frag1Screen</screenName>
    <screenName name="com.purpledecks.bottomsup.fragments.frag2">frag2Screen</screenName>
    <screenName name="com.purpledecks.bottomsup.fragments.frag3">frag3Screen</screenName>
</resources>

Then in my frag1 I set it up to send the hit as follows:

bottomsUp = (BottomsUpApplication) getActivity().getApplication();
Tracker t = bottomsUp.getTracker(BottomsUpApplication.TrackerName.APP_TRACKER);
t.setScreenName("frag 1");
t.send(new HitBuilders.AppViewBuilder().build());

In my log cat I have the following:

09-16 11:45:02.552  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: connecting to Analytics service
09-16 11:45:02.572  32411-32411/com.purpledecks.bottomsup V/GAV4﹕ Thread[main,5,main]: service connected, binder: android.os.BinderProxy@43a2e1e0
09-16 11:45:02.572  32411-32411/com.purpledecks.bottomsup V/GAV4﹕ Thread[main,5,main]: bound to service
09-16 11:45:02.572  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: connect: bindService returned true for Intent { act=com.google.android.gms.analytics.service.START cmp=com.google.android.gms/.analytics.service.AnalyticsService (has extras) }
09-16 11:45:02.572  32411-32411/com.purpledecks.bottomsup V/GAV4﹕ Thread[main,5,main]: Connected to service
09-16 11:45:02.572  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: Loaded clientId
09-16 11:45:02.582  32411-32484/com.purpledecks.bottomsup I/GAV4﹕ Thread[GAThread,5,main]: No campaign data found.
09-16 11:45:02.582  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: Initialized GA Thread
09-16 11:45:02.602  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: putHit called
09-16 11:45:02.602  32411-32484/com.purpledecks.bottomsup V/GAV4﹕ Thread[GAThread,5,main]: Sending hit to service   PATH: https:  PARAMS: ul=en-ie,  ht=***********,  sr=1080x1920,  aid=com.analytics.test,  cid=*******************,  av=0.0.1,  v=1,  adid=**************,  t=appview,  an=Cheers!!,  ate=1,  tid=UA-********-*,  _u=.2nK-AL,  cd=frag 1,

The same question has been asked here but there was no solution...any ideas? or is there a certain way I should set up the property with the project name?

So it tells me that it is sending the hit but nothing appears on the dashboard. If anyone could help me on this or see what I've done wrong I'd appreciate it.

Community
  • 1
  • 1
DJ-DOO
  • 4,545
  • 15
  • 58
  • 98
  • 1
    1. when did you create the Analytics account? it can take 48 -72 hours for that to kick in. 2. check the real-time reports are they showing data? Standard reports can take up to 24 - 48 hours to show data? – Linda Lawton - DaImTo Sep 16 '14 at 11:16
  • @DaImTo just created it yesterday evening about 3pm GMT, so that might be the reason, real time reports is the section I was checking. Does everything else look ok? – DJ-DOO Sep 16 '14 at 11:27
  • 3
    I would give it another day, new accounts normally kick in by 48 hours. I cant see anything wrong with your code. – Linda Lawton - DaImTo Sep 16 '14 at 11:28
  • @DJ-DOO did you find the answer? Now i am having the same issue. – Anatol Nov 25 '14 at 10:38
  • 1
    yep...I just had to wait as @DalmTo said to me, if you wait 48 hrs...it takes time to activate – DJ-DOO Nov 25 '14 at 11:48
  • 1
    So funny, I waited 2 days, after that I was forced to migrate from GA to flurry, It is more understandable library – Kirill Shalnov Dec 30 '14 at 22:58
  • @DJ-DOO any chance you want to answer your own question? This questions is still open but it seems you found the answer. – samthebrand May 06 '15 at 04:58
  • @samthebrand ok if it's troubling you. I couldn't accept the correct solution because it's a comment not an answer. – DJ-DOO May 06 '15 at 08:58

1 Answers1

4

As requested I'm adding the answer provided by @DalmTo, which was provided as a comment.

If you have just set up your Google Analytics and application data isn't showing up on your dashboard, it normally takes 48 hrs to activate. So if you aren't seeing data allow this amount of time to pass.

DJ-DOO
  • 4,545
  • 15
  • 58
  • 98