Reputation: 49
Actually I want to track the time an user spent in App , successful login event and registration event in my App using Google Analytics. how to do it?
Upvotes: 0
Views: 626
Reputation: 800
Get it the start time and store it somewhere when the app starts the Registration activity.
long startTime = Calendar.getInstance().getTimeInMillis();
Also get the end time after the user logged in to the app.
long endTime = Calendar.getInstance().getTimeInMillis();
Get the time spent by the user.
long timeSpent = endTime - startTime;
Then use the 'GoogleAnalyticsTracker.getInstance().setCustomVar()' method to set this data inside your track event.
Upvotes: 1