Im testing the google analytics plugin with phonegap build.
And it counts the index page right, but when I try to count loading a subpage from my server, it counts that page 5 times?
I have set up e webpage account at google. with http://www.mydomain.se
The pages that I load in the app are at http://www.mydomain.se/somefolder/new...
And I have the following code:
function onDeviceReady()
{
document.addEventListener("resume",onResume,false);
gaPlugin = window.plugins.gaPlugin;
gaPlugin.init(successHandler, errorHandler, "UA-xxxxxxx-1", 10);
gaPlugin.trackPage(successHandler, errorHandler, "index.html");
}
function onResume(){
gaPlugin.trackPage( successHandler, errorHandler, "index.html");
}
function successHandler (result) {
alert('successHandler - '+result);
}
function errorHandler (error) {
alert('errorHandler - '+error);
}
function PageButtonClicked() {
gaPlugin.trackPage( successHandler, errorHandler, "http://www.mydomain.se/somefolder/new...");
}
When I load the news page then the alert pops up 5 times.
Can anybody please tell me where Im going wrong, thanks!
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
I would suggest either turning Debug on in PhoneGap Build, or sprinkling log messages in all 3 locations where you are calling gaPlugin.trackPage.
My guess is you are getting multiple calls to resume(). -
-
Hi Bob, yes I will try it and see if it is something with resume.
-
Loading Profile...



