[mono-android] Problem with binding of Google analytics tracker library

Jonathan Pryor jonp at xamarin.com
Thu Jun 7 15:45:35 UTC 2012


On Jun 7, 2012, at 11:25 AM, Petr Slováček wrote:
> I discovered there's an option to switch on debug mode for that Google analytics library and then it shows more information what it actually does.
...
> Any idea why it behaves like this? I haven't this problem when using this library in my original Java application.

Good question. Enable logging in your Java app and see what the output is. :-)

What I find interesting is that in your single dispatch case, you hit www.google-analytics.com once:

> If it sends just one hit it looks like this:
> 
> V/GoogleAnalyticsTracker(19436): Called dispatch
> V/GoogleAnalyticsTracker(19436): Sending 1 hits to dispatcher
> I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
> I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
> I/GoogleAnalyticsTracker(19436): GET ...
> V/GoogleAnalyticsTracker(19436): HTTP Response Code: 200

while in your multiple dispatch case, you hit it twice, once _before_ the "Sending 2 hits to dispatcher", and once after:

> V/GoogleAnalyticsTracker(19436): Called dispatch
> I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
> I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
> I/GoogleAnalyticsTracker(19436): GET ...
> V/GoogleAnalyticsTracker(19436): Sending 2 hits to dispatcher
> I/GoogleAnalyticsTracker(19436): Host: www.google-analytics.com
> I/GoogleAnalyticsTracker(19436): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
> I/GoogleAnalyticsTracker(19436): GET ...
> V/GoogleAnalyticsTracker(19436): HTTP Response Code: 200

I have no idea what that means; I just find it interesting.

What's also interesting is telnet:

	$ telnet www.google-analytics.com 80
	User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 4.0.4; cs-cz; MT11i Build/4.1.B.0.431)
	GET ...

When I enter the GET url from the working case, I get an HTTP 207 response (not 200), with a nested HTTP 400 Bad Request error. (Clearly my telnet-fu is lacking, and/or I need to provide additional HTTP headers.)

However, if I use the multi-dispatch GET url, I just get an HTTP/1.0 400 Bad Request. Clearly these two URLs are not equal.

In short, I have no idea what's going wrong, or why it's breaking; there's just lots of interesting stuff there. ;-)

Perhaps you should ask on the Google Analytics support list? They may have other ideas. Is your app multi-threaded, by any chance? Perhaps you have multiple concurrent requests in flight at once?

 - Jon



More information about the Monodroid mailing list