App analytics, or mobile app analytics, is the measurement and analysis of data generated when users interact with your mobile applications. Analysing how user is interacting with UI, sessions, app visitors. Using analytics we can also measure performance of app. Analytics gives insights about how user using the app.
Consider for example there is button in your app and you want to track how many users clicked it.
Now consider users as number of people visiting your app. For users analytics can be divided into following two
1]Across all users
Across all users: Consider example of Click Me button above. Analytics across all users can be how many users clicked the button
User Specific: Again consider example of Click Me button above. Finding out how many times a specific user has clicked the button will be user level analytics in this case.
Now there are many Analytics tools available. Commonly used are flurry, google analytics, firebase etc.
Now there two ways to implement Analytics in app
1]Using rest API call
2]Using Analytics tools
I have conducted many interviews many candidates are aware of analytics but most of them have not used any analytical tools when I asked them how do they measure app usage and track user behaviour? Answer I got was using Rest API call
1]Using rest API call
So let’s discuss how exactly rest API are used for analysing user behaviour.
Now consider we are making a rest api call on clicking button lets api call is
Now based on how many times this api is called we can decide how many users have clicked this button
Other question is how to do this analysis user specific how to identify number of times user has clicked the button.For this we will have to generate user specific unique in our app let’s call it user_id for now.
You can generate this user_id on first app launch and save it locally in app.
Consider following example
String user_id = UUID.randomUUID().toString();
Above JAVA code will generate a unique id for a user. You can generate and store this id at first app launch.
Wow well done !!!! you have created user specific unique id now you can pass this user Id in every api call example
now logs of this api call will give you how many times specific user has clicked a button.
Now consider another real world example in a shopping app you want to track how many times user has seen a product.
lets consider following is api call for it
Now here we are passing two unique parameters in rest API call first is user_id which is generated by us and second is product_id which is unique for every product. So by collecting logs for this api call we can see how many users have seen a particular product, how many times specific user has seen the product.
You can also pass other parameters as well for example
2]Connection type(wifi, 4g, 3g)
4]campaign (utm_source,utm_medium and utm_campaign)
One important thing to note don’t pass any user sensitive information such as email, name, phone number in rest api call. In case you are passing is make sure you are taking necessary security measures and not violating any policies.
Thats it for this chapter. Hope you guys have got basics of analytics. In next chapter we will discuss
Analytics tools (Events and event properties, User and user properties, Session tracking,Install tracking, user specific)
Next article link https://medium.com/@amodpkanthe/add-analytics-to-your-app-2-6c023d92ec24