Ferrari
Posts: 0
Joined: Wed Apr 04, 2012 12:04 am

Tracking user actions?

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?

Ferrari
Posts: 0
Joined: Wed Apr 04, 2012 12:04 am

Tracking user actions?

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Tracking user actions?

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

Ferrari
Posts: 0
Joined: Wed Apr 04, 2012 12:04 am

Tracking user actions?

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Tracking user actions?

What do you mean by "full Google Analytics"?

Ferrari
Posts: 0
Joined: Wed Apr 04, 2012 12:04 am

Tracking user actions?

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Tracking user actions?

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.

Return to “Issues”