I've only tried this in iOS, but here's how I got it working *without* using a plug-in.
Essentially, Google Analytics won't work if its being used from a file:/// url. In iOS/PhoneGap this is the case. In order to solve this problem you must first download the ga.js file from google and include it as part of your local build. You'll notice the this file is obfuscated. Search the file for the string "file:" which should occur only once. When you find it, add an underscore to the beginning (so it becomes "_file:"). This prevents it matching the protocol of the page location (which is "file:").
Now include the modified file in your program rather than the remote ga.js file and you'll find that analytics information will start to appear (check the Realtime display - very helpful of debugging).
Let me know if it works on Android.
On Wednesday, March 14, 2012 7:25:04 AM UTC-7, Massimo Nicolardi wrote:
I am trying to install google analytics tracking code on a cordova (1.5.0) application (android) but I have had no success.
I tried to use this code:
var _gaq = _gaq || ;