Testing iOS/Android app google analytics - google-analytics

I've been searching for many hours, but I havent been able to come up with a solution to the following problem:
I want to be able to test the implementation of Google Analytics in an app, in real real time. Using google real-time analytics is insufficient, because you sometimes have to wait several minutes for your new tag to show up.
A solution should be packet sniffing through Wireshark. I've attempted to do this, But even when I do find some analytics related calls, I cant seem to extract any useful information from them.(I have to admit, I dont know enough about networks to understand wireshark's features....)
Another solution should be using a proxy like Fiddler or Charles. I tried both, set up SSL, rooted an android phone to make sure all the traffic was using the proxy, but even then I'm not able to find any google analytics calls from my app.It seems like I'm looking in the wrong place or something, but for websites I do see these GA calls come by.
What am I doing wrong? It's so easy to find this stuff on web, and so far it has seemed impossible to get if from an app. Any help is appreciated.

By default Google Analytics uploads the hits data over SSL connection. It might be difficult for Wireshark to see inside the encrypted connection. The HTTP stack will likely check the certificates and refuse to talk to the wrong server as well. You can change the upload to non-SSL (plain HTTP) by calling tracker.setUserSecure(false):
https://developer.android.com/reference/com/google/android/gms/analytics/Tracker.html#setUseSecure(boolean)
That should allow you to see the uploads with Wireshark or any other packet analyzer. Make sure you don't ship your application with this setting.
The hits will also have some delay before they are uploaded over the network. If you are running on Google Play device (or emulator with Google Play Services) your hits will be dispatched by Google Play within few minutes. When running on non-Google Play devices (or emulator without Google Play Services) you can set the dispatch interval with googleAnalytics.setLocalDispatchPeriod(int seconds) call or explicitly trigger a dispatch with googleAnalytics.dispatchLocalHits()

Related

Why so many time out from Google related URLs from time to time?

My website uses Google Ads Conversion and Google Analystics. From time to time, I will see Chrome reports errors in accessing Google related URLs, such as
GET https://www.googleadservices.com/pagead/conversion_async.js net::ERR_TIMED_OUT
A screenshot is put below:
THe error is generated from Google Tag Manager with the following URL:
https://www.googletagmanager.com/gtag/js?id=AW-1071615551&l=dataLayer&cx=c
I am curious why this will occur so frequently since Google has the best server and network connection in the world?
I have seen some report indicating Google Server is the best, for example:
Google CDN is the 2nd fast, see https://www.cdnperf.com/
Another report is not in English so I do not put it here.
I've been working with various Google services for a while now. Have never seen a timed out or a different kind of errorous hit except in cases:
Sudden client connection loss. Especially with mobile traffic.
Second Most popular issue - adblockers. They tend to block tracking too. Often by interfering with the network requests, resulting in network errors that then surface in datadog/dynatrace and whatnot.
When it's impossible for the client to play its encryption part, which is likely either due to there being a middle man sniffing the traffic, or, which is actually more common, the client having a completely wrong date. This should be quite a rare occasion
When there's a firewall-like filtering in place blocking requests to Google servers. Even more rare in my experience.

What would cause events to suddenly stop being sent to/recevied by firebase?

We are using Firebase/Google analytics for our Android and iOS app. Everything seemed to be sending data correctly and we were able to view the data in Big Query etc. However we started to notice that some data seemed to be getting lost.
We detected an odd situation where some users' analytics data stopped showing on Firebase/Google Analytics/Big Query, despite having previously received data from that user in the past. The data seems to just stop at a random point in time, for random users.
in_app_purchase events from those players were still appearing in the data on dates where they didn't have any other events. We checked our backend service (gamesparks) for their account and could see that they were active players who had been using the app very recently. That is, after their last event was appearing in Big Query.
After investigating some more and started finding other users who had the same issue. They would be sending data without issue and then all of a sudden we would receive nothing from them, except from in_app_purchase events/notification events etc which are sent via a seperate service (app store etc) rather than the client.
After scouring our implementation and going over it line by line comparing to the samples/documentation we couldn't really see any issues, and even the automatic events (session_start etc) stop appearing. We made sure we were using the latest versions of the firebase SDKs etc in the hope it would fix it but it made no difference.
One peculiar thing is that when we find a in_app_purchase event from one of these 'broken' players, things like the user properties and default parameters for that player have changed from when they stopped sending data, so it seems like the lost data is somewhere but not being logged anywhere.
I was wondering if it was possible for specific users to stop their app sending any analytics data to Firebase via a device/google account setting?
While looking into the documentation we noticed that if Google Play Services is installed on the device, data is sent via that, rather than via the client/firebase sdk itself. Is there any known issue with players changing their Google Play Services settings that could cause something like this?
Wondered if this was a known issue but please let me know what other information you might need.
EDIT: I also wanted to mention that although we can't be 100% certain, we believe this is only happening to our Android users. We haven't found any iOS users that have the same issue.
Thanks,
Matt

Server disables page after several GET requests from SIM908

I set up a free domain on 000webhost.com
I am using this as a web server to receive data from SIM908+arduino setup and store it in the database. Then display it on a web page.
I am sending the data from the SIM908 using HTTP GET requests. Basically I am sending two pieces of information, one is the location (lat and long) and other is a string. Both are sent using GET requests. The problem is very unusual so bear with me. EVERYTHING WORKS FINE, for a while. After several GET requests are sent, for some reason, 000webhost just deactivates my domain. I simply cannot access it. Every time I try to browse to the page it times out. It remains like this for around 7-8 hours after which the domain works fine again. I tried another hosting byethost.com, but GET requests from the SIM908 do not work there at all. Everything is 100% OK. The code, arduino setup everything is fine. My question is why is 000webhost stopping my domain? Really need a good answer or at least some direction, i am completely lost.
**NOTE: Please don't suggest POST method unless you explicitly know how to perform a POST operation using SIM908 AT commands, as far as I know it's not possible.
You are using the free webhost which has limitations. They will block you if your site is getting too much requests. Just read the limitations of free accounts with the server.
Look for a better free service or buy one. There is no issue with sim900 or arduino.
The following hosting service providers might be better than the one you are currently using in terms of limitations
Host Buddy You would get two months free
Free Hostia
Free Hosting .eu

Capturing http data packets on chrome as long as browser active

I'm trying to develop a chrome extension which will capture http packets, their source and destination URLS, the packet size.
Basically I want to know how much time the user spends on a particular site for the duration the browser is active.
I used JNetPcap and successfully have written a java code for the same but i cant find a way to implement the browser close event in Java.
Also chrome extensions need to be in javascript.
Can anyone suggest a way to go about this?
Your initial approach is flawed to begin with. What do you mean by "time spent on a site"? The page loads, packets cease to flow, yet the user is still reading the page. Just network analysis is hardly a good metric.
And what about external resources? Do your users "spend time" on Google Analytics website when trackers make their requests?
If you are dead-set on network capture, chrome.webRequest or chrome.webNavigation APIs should let you tap into requests made by the client.
As for implementing this properly as a Chrome extension, it should be trivial. You can use chrome.tabs API to keep track of open/active tabs.
Declare "tabs" permission to get access to URL data
On initialization, query current tabs (or just the active tab)
Listen to onCreated for new tabs, or better yet for onActivated for change of visible tab (possibly do so with windows too, there's a separate API for that)
Within the active tab, track URL changes with onUpdated
If you're new to extension development, start with the Overview. Good read, and a good hub to other documentation.
As for recommending JavaScript resources, I'll pass; too many of them.

What are proper ways to count application launches?

Say, I'm developing a Windows (if OS is important) application that will be available to download for free and I would like then to collect some usage statistics. In the easiest case - count of application launches. It looks superfluous to maintain a server (e.g. VDS) just for this.
I've been thinking to use Google Analytics for this (manually send requests to GA server). This will probably work, but it is not GA designed for - the idea looks like a hack.
What are the options here?
I don't think this is a hack. It's all just data about user interaction. There is little logical difference between opening a desktop app and clicking a button vs opening a web page and following a link. Both are measurable user actions you can track, aggregate and put on graphs.
In fact, Google provides a lower level HTTP based "Measurement Protocol" that is intended for exactly that.
https://developers.google.com/analytics/devguides/collection/protocol/v1/
From the overview:
The Google Analytics Measurement Protocol allows developers to make
HTTP requests to send raw user interaction data directly to Google
Analytics servers. This allows developers to measure how users
interact with their business from almost any environment
Just put an HTTP request with the correct parameters in your application launch or button click code and it will collect the data. Any data you want to collect.
In other answers to this question there are suggestions like making web services or storing the data locally but why reinvent the wheel? Google Analytics already provides the collecting and reporting tools and it seems like a good solution.

Resources