0

I've finished a project and have tried using GoogleAnalytics v3 for Android. I have followed all their instructions, but no devices are found. Do I need to use Google Analytics v4?

Per your response below, attached are the relevant sections.

  • In my values section I have an analytics.xml file with the following code:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="ga_trackingId">UA-xxxxxxxx-2></string>
        <string name="ga_autoActivityTracking">true</string>
        <bool name="ga_reportUncaughtExceptions">true</bool>
    </resources>
    
  • In my main activity, I have the following code in onStart():

    EasyTracker.getInstance(this).activityStart(this);
    easyTracker.send(MapBuilder.createEvent("home", "feature event", null, null).build());
    
  • In my main activity, I have the following code in onStop():

    EasyTracker.getInstance(this).activityStop(this);
    
  • Attached is a sample tag for the activity:

    easyTracker.send(MapBuilder.createEvent("home", "feature event", null, null).build());
    
  • For fragments attached to the activity, I do the following:

    In onCreate():

    easyTracker = EasyTracker.getInstance(getSherlockActivity());
    

    In onResume():

    easyTracker.set(Fields.SCREEN_NAME, "Maps");
    easyTracker.send(MapBuilder.createAppView().build());
    

Still, I am getting no response from google analytics.

Alexander Malakhov
  • 3,383
  • 2
  • 33
  • 58
Jack120
  • 213
  • 1
  • 6
  • 21

1 Answers1

2

No. v3 sdk will work as well as v4 sdk. If you just implemented everything in v3, keep using it till you have time to migrate. If you see that there is a feature in v4 that was not in v3, you will have to migrate.

The code snippets that you provided looks correct. Can you confirm that the tracking is not UA-xxxxxxxx-2 and you have just obfuscated it for posting here?

Also, Does the SDK print any log statements? Can you set ga_logLevel to verbose and see if there are any error messages that sdk spews in logcat?

Avi
  • 2,373
  • 17
  • 22
  • 2
    It is would worth noting that v4 will be "sort of mandatory" by August 2014. You will see a warning in the log about this. Also seems like v4 doesn't support the EasyTracker anymore. – Martin Marconcini Apr 24 '14 at 20:27
  • What do you mean by mandatory? Is there a link that says so? v4 does not have a class called EasyTracker but it does have most of the functionality that EasyTracker provided. If it does not, feel free to comment here and we'll take a look :) – Avi Apr 24 '14 at 23:38
  • 1
    Not "mandatory" but sort of. I was referring to the GoogleAdMobSDK 6.jar which was ok (especially if you used DoubleClick because it was not supported in GooglePlay until recently). So if you used DoubleClick for Publishers you could only use AdMobSDK. Now I saw the following: `I/Ads﹕You are using version 6.4.1 of the AdMob SDK which is non-compliant with the Google Play Ad Policy (http://goo.gl/6OZelH). On August 1st, 2014, Google Play will stop accepting updates to apps using this SDK. Upgrade to Google Play services now to avoid this deadline."` I have upgraded since then. – Martin Marconcini Apr 25 '14 at 00:11