0
votes

I'm developing a commerce guide app. Inside the app, are going to be a list of different commerces with his own private section called CommerceActivity.java. Inside that activity I will display all the information about a specific commerce that the user choose to see.

Now, I would like to keep account of the visits for each commerce. I thought of placing a piece of code in CommerceActivity whose function is to save a *.txt file on my server that in his name contains the ID of the user device, the name of commerce visited and time of the visit, so after performing the visual count the visits. Do you know a better aproach for this? Thank you for your time.

3
Use an existing analytics package, for example: developers.google.com/analytics/devguides/collection/android/v4 - Ken Wolf
Why a txt and not a db table? - Pier Giorgio Misley

3 Answers

1
votes

I like Google Analytics.

There's a sample from Google on how to setup and use it:

https://developers.google.com/analytics/devguides/collection/android/v4/

Hope that helps =]

0
votes

It would preferable if you use a db instead of a txt. And in the db you will have a table called "commerces" with a column of "view_count", that will be updated when ever a client(your android app in your case) requests for that commence. the updating should be done by the server not the client and unless its a log (with some trade offs) or image resource(large sized) its not wise to have your data on a text on the server hard disk and read or write from it. It really damages performance among other issues.

0
votes

Mixpanel is simple to use and has powerful web dashboard to see how users behave and who they are.
It's free when you sent up to 25 000 events per month. If you send more you still have access to your stats but without those new events.

Sending an event:

try {
    JSONObject props = new JSONObject();
    props.put("Gender", "Female");
    props.put("Logged in", true);
    mixpanel.track("MainActivity - onCreate called", props);
} catch (JSONException e) {
    Log.e("MYAPP", "Unable to add properties to JSONObject", e);
}

Storing user profiles:

mixpanel.getPeople().identify("13793");
mixpanel.getPeople().set("Plan", "Premium");

That two pieces of code are all you need in order to collect actions about particular users in your app.

Read more in tech doc.