You can write your own PhoneGap plug-ins (basically a JavaScript to Native code bridge). This would give you the freedom to use any of the current native solutions out there which do have offline support (Webtrends, GA, Flurry, ...).
See : http://wiki.phonegap.com/w/page/36752779/PhoneGap%20Plugins
You would have to create one JavaScript file and one Native file per platform you wanted to support. In your Native code you would do a call to your tracking vendor's SDK.
I used the Android example and just put this example together as a sample. Please be advised this wasn't tested at all or even put into an IDE. I simply edited the provided examples in notepad++ :-)
//Java
public class TrackingPlugin extends Plugin {
public static final String ACTION="pageView";
@Override
public PluginResult execute(String action, JSONArray data, String callbackId) {
Log.d("Tracking", "Plugin Called");
PluginResult result = null;
if (ACTION.equals(action)) {
try {
String pageTitle= data.getString(0);
JSONObject res = new JSONObject();
SOME_TRACKING_API.Track(pageTitle);
res.put("status","OK");
result = new PluginResult(Status.OK, res);
} catch (JSONException jsonEx) {
Log.d("DirectoryListPlugin", "Got JSON Exception "+ jsonEx.getMessage());
result = new PluginResult(Status.JSON_EXCEPTION);
}
} else {
result = new PluginResult(Status.INVALID_ACTION);
Log.d("TrackingPlugin", "Invalid action : "+action+" passed");
}
return result;
}
//JavaScript
/**
* @return Object literal singleton instance of Track
*/
var Track = function() {
};
/**
* @param pageTitle The title for a new view
* @param successCallback The callback which will be called when track call is done
* @param failureCallback The callback which will be called when track call is done
*/
Track.prototype.pageView = function(pageTitle,successCallback, failureCallback) {
return PhoneGap.exec(
successCallback, //Success callback from the plugin
failureCallback, //Error callback from the plugin
'TrackingPlugin', //Tell PhoneGap to run "TrackingPlugin" Plugin
'pageView', //Tell plugin, which action we want to perform
[pageTitle]); //Passing list of args to the plugin
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin("Track", new Track());
});