Page 1 of 1

Tracking user actions?

Posted: Mon Apr 09, 2012 3:08 am
by Ferrari

What is the simpler way to track clicks and screen views of my app created with tiggzi? Any interface with Google Analytics or other web services?


Tracking user actions?

Posted: Mon Apr 09, 2012 4:13 am
by Ferrari

I was able to track a screen if I embed google analytics code inside a html panel:
code
<head>

<script type="text&#47;javascript">
var _gaq = _gaq || [];
gaq&#46;push(['setAccount', 'XX-XXXXXX-X']);
gaq&#46;push(['trackPageview']);

(function() {
var ga = document&#46;createElement('script'); ga&#46;type = 'text&#47;javascript'; ga&#46;async = true;
ga&#46;src = ('https:' == document&#46;location&#46;protocol ? 'https:&#47;&#47;ssl' : 'http:&#47;&#47;www') + '&#46;google-analytics&#46;com&#47;ga&#46;js';
var s = document&#46;getElementsByTagName('script')[0]; s&#46;parentNode&#46;insertBefore(ga, s);
})();
<&#47;script>

<&#47;head>
/code
but this will only work within the web-based Tiggzi test app and not the .apk package. When I look inside the Eclipse code generated, I see my app screens are generated as html, so google analytics should work, am I missing something?


Tracking user actions?

Posted: Mon Apr 09, 2012 11:13 am
by maxkatz

It should work in the native (hybrid PhoneGap) app as well.


Tracking user actions?

Posted: Mon Apr 09, 2012 6:27 pm
by Ferrari

I found a workaround that works on .apk, only problem is that every action is seen by GoogleAnalytics as a new user:
code
new Image()&#46;src='http:&#47;&#47;nojsstats&#46;appspot&#46;com&#47;UA-XXXXX-1&#47;'+Math&#46;random();
/code

You can add this single line as part of any "Run Custom Javascript" code and Google will track users. Just change XXXXX with your googleAnalytics code.

Any suggestion on how to implement the full Google Analytics so that I can have a better idea of what users are doing on my app?

PS: you can create different UA number ID that will track different actions, still not ideal, but it a working solution


Tracking user actions?

Posted: Tue Apr 10, 2012 3:25 am
by maxkatz

What do you mean by "full Google Analytics"?


Tracking user actions?

Posted: Tue Apr 10, 2012 3:55 am
by Ferrari

one of the many event you can track with googleAnalytics is trackPageview, but you can also trackEvent, sets goals, etc.

In my app I"d like to just setup googleAnalytics for tracking pages views and still retain the user session so that each click in correctly assigned to user. My current working code does not allow that (see my new Image line above). For some reason once the app is packaged into a .apk I loose the ability to use the HTML panel that works fine within the web-based test page.


Tracking user actions?

Posted: Tue Apr 10, 2012 1:11 pm
by maxkatz

This might help: http://stackoverflow.com/questions/80....

To usethe plug-in, you would have to export the app source and install the plug-in manually for now.