Google analytics doesnt work in app

0
Hello there, I've added the Google Analytics widget to my mendix project and implemented it in a few pages. The app is running in the acceptance enviroment and i build the app for iOS and Android with the phonegap builder, this is all working great. However when i go through these pages on my phone it doesnt register in Google Analytics, its works fine in my normal browser on the desktop though. Just to be sure ive added <access origin="https://www.google-analytics.com" /> to the custom phonegap configuration but that did not help. Anybody know what im doing wrong?
asked
2 answers
12

Hi Hunter,

EDIT: Download the new version with the fix in it: https://appstore.home.mendix.com/link/app/105/Mendix/Google-Analytics

----

We fixed that in the widget (I'll create a pull request for it also on Github) but you can change the widget by yourself by extract GoogleAnalytics widget and change the file TrackerCore.js :

change line 41-48 

        _insertGoogleAnalytics: function () {
            logger.debug(this.id + ".TrackerCore._insertGoogleAnalytics");
            this._addGoogle(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");

            if (typeof window.mxGoogleAnalytics === "undefined") {
                ga("create", this.uaTrackCode, "auto");
            }
        },

to

  _insertGoogleAnalytics: function () {
            logger.debug(this.id + ".TrackerCore._insertGoogleAnalytics");
            this._addGoogle(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga");
			
            if (typeof window.mxGoogleAnalytics === "undefined") {
                ga("create", this.uaTrackCode, "auto");
            }
			
			ga("set", "checkProtocolTask", null);
        },

 

this will show you mobile traffic in your Google Analytics :)

answered
0

Thanks, that worked!

answered