How do I use Google Analytics with Phonegap without a plugin?


I am making an app and I want to get analytics from the users. I tried to use the Phonegap Plugin, but I didn't have any luck trying to implement it.

I was wondering if it was possible to get Google Analytics by treating the app like a normal webpage and putting some javascript in the head of my page.

Is there a better way to do this? and is the Phonegap Google Analytics THAT much better than what I'm trying to do?

The pokki solution suggested by Alex is working fine with a few adjustments to remove the need of Pokki.

I created a git project for this cleaned-up version here :

Works great on android 4.1 and ios6, I will test more device very soon. Hope this helps ! :)