Google Analytics Blocks Android App

Google Analytics blocks Android App

i had similar i removed the below code and application runs..

<meta-data 
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics_global_config" />

and add following code for getTracker class... build the GoogleAnalytics using java code rather than XML approch

synchronized Tracker getTracker(TrackerName trackerId) {
Log.d(TAG, "getTracker()");
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);

// Global GA Settings
// <!-- Google Analytics SDK V4 BUG20141213 Using a GA global xml freezes the app! Do config by coding. -->
analytics.setDryRun(false);

analytics.getLogger().setLogLevel(Logger.LogLevel.INFO);
//analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);

// Create a new tracker
Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.ga_tracker_config) : null;
if (t != null) {
t.enableAdvertisingIdCollection(true);
}
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}

Android app and google analytics

It works!

I recreate the account for application, and i use new json file with new USER-ID.

Also I delete the following lines of MainActivity code

//in onResume class
mTracker.setScreenName(name);
mTracker.send(new HitBuilders.ScreenViewBuilder().build());

and Ι create a function about that and I call it sendScreenName()

private void sendScreenName() {
String name = "MainActivity";

// [START screen_view_hit]
mTracker.setScreenName(name);
mTracker.send(new HitBuilders.ScreenViewBuilder().build());
// [END screen_view_hit]
}

For the end, I added the following line in the end of onCreate:

 sendScreenName();

After all, when I open my application i saw the magic "1" number on analytics.google.com reports (real time)!

Google Analytics For Android: No tracking information displayed

It might be worth checking that you are using the right SDK with the right property setting in Google Analytics.

If you are using SDK 2.0 you need to select "app".
If you are not but are using a legacy version then you would need to select "website" and then put in a dummy web address. It wont use the dummy address but will instead accept the data from the SDK.

Please let me know if this helps or if you need me to be more specific.

Google Analytics in Android Web app does not work in 4.0 or higher

I figured it out. You need to add:

_gaq.push(['_setDomainName', 'none']);

before

_gaq.push(['_trackPageview']);

and it will work on Android 4.1.1 at least.

Default Android host files block Google Analytics?

Just reinstall AdAway - if you believe it's the cause of the problem - and select Disable Ad Blocking. This should restore the original hosts file that came with your Android firmware.

If that still doesn't work, then you can manually edit the hosts file to give you access to Google Analytics. The hosts file is located at /etc/ directory. Use a file explorer to navigate to this directory and edit/save the hosts file with a text editor.

Note: You'll need root permission to edit the hosts file under /etc/ directory since this directory is reserved for system apps or access with root privileges.



Related Topics



Leave a reply



Submit