angular-google-analytics icon indicating copy to clipboard operation
angular-google-analytics copied to clipboard

How to use Analytics with older Android devices (Android browser instead of Chrome)

Open armyofda12mnkeys opened this issue 9 years ago • 9 comments

I am seeing 3.3% of our traffic not show up in GA anymore... I noticed between our old app which uses old Universal Analytics and new Angular app which uses Universal Analytics (via angular-google-analytics) that the new data is missing the 'Android Browser' browser which was about 3.3% of traffic. Both apps have the Browser 'Chrome' which has Browser Versions like 43.0.2357.124 which could be mobile or desktop.... but older Android devices should have a Browser of 'Android Browser' which versions like 4.0, 4.1, 4.2. I confirmed with an Android device that it isn't sending up the data at all by watching the Real-Time data.

Wasnt sure if someone could confirm or take a look.

Thanks, Ari

PS here are the devices that this issue probably occurs for (pulled from the old GA data): Samsung GT-P3113 Galaxy Tab 2 7.0 HTC 0PCV220 Desire 510 Samsung SPH-L710 Galaxy S III Samsung GT-P5113 Galaxy Tab 2 10.1 Samsung SM-T217S Galaxy Tab 3 7.0 Samsung SGH-T999 Galaxy S III Samsung SGH-I747 Galaxy S III

armyofda12mnkeys avatar Jun 24 '15 19:06 armyofda12mnkeys

i have the same problem. i am not reciving data using android 4.2, i try with a web google analitycs account and wiith mobile app one

DEG-7 avatar Nov 13 '15 16:11 DEG-7

@reyazucar is it possible for you to determine what might be a needed fix for this?

One possible solution I found on the web is: http://stackoverflow.com/questions/13415368/google-analytics-in-android-web-app-does-not-work-in-4-0-or-higher

Please let me know if that works for you and we can try to figure out a change to incorporate in this script specifically for Android. It would seem to be an oddity in Chrome for Android.

justinsa avatar Nov 14 '15 04:11 justinsa

I am encountering the same issue on some Android test devices for my Ionic app. Running the app via browser works fine, same for iOS. So the problem seems to be due to Cordova and Android. It is probably the same as #124.

From what I observed, not a single request for a tracking pixel goes out to https://www.google-analytics.com/collect. No matter if a pageView or a trackEvent occurred. However analytics.js is there and the logs array via AnalyticsProvider.logAllCalls(true); got the right data.

denyo avatar Dec 06 '15 14:12 denyo

did you check cordova whitelist and CSP ? thse are security restrictions for cordova apps : https://github.com/apache/cordova-plugin-whitelist#content-security-policy

revolunet avatar Dec 06 '15 21:12 revolunet

@revolunet Do you think this would be useful information to add to the Troubleshooting or Hybrid-mobile Mode section of the README?

justinsa avatar Dec 07 '15 01:12 justinsa

@revolunet i have google analytics in the whitelist.

This is my tag:

arjandew avatar Dec 08 '15 12:12 arjandew

Is there a resolution for this? Does it actually work? I am not using cordova just some local assets in the Android app. Nothing is posted to GA (yet works through browser).

Bit of a goose chase here since it is made clear in the docs that hybrid is supported.

Is it some unknown android permission?

alastair-todd avatar Feb 09 '16 15:02 alastair-todd

@alastair-todd see: https://github.com/revolunet/angular-google-analytics/issues/124

denyo avatar Feb 09 '16 15:02 denyo

Woo hoo! Thanks. My working config code for people (it requires):

bower install angular-uuid4


// configure google analytics
app.config(function (AnalyticsProvider) {
    var uuid4 = angular.injector(['uuid4']).get('uuid4');
    var clientId = localStorage.getItem('GA_LOCAL_STORAGE_KEY');
    if (!clientId) {
        clientId = uuid4.generate();
        localStorage.setItem('GA_LOCAL_STORAGE_KEY', clientId);
    }
    AnalyticsProvider
        .setAccount({
            tracker: 'UA-XXXXXXXX-2',
            fields: {
                storage: 'none',
                clientId: clientId
            }
        })
        .setHybridMobileSupport(true);
});

alastair-todd avatar Feb 09 '16 15:02 alastair-todd