Skip to content

Community Bonding Period II

Tarun Kumar Singhal edited this page May 31, 2017 · 13 revisions

The primary focus of the previous week was to come up with the list of events which can be used for tracking user behavior in sugarizer. Following is the structure finalized for the logs collection in MongoDB.

[{
    "user_id"         : "592d4445cc8be9187abb284f",
    "user_agent"      : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
    "user_ip"         : "122.34.42.165",
    "client_type"     : "mobile",
    "source"          : "sugarizer",
    "event_object"    : "home_view",
    "event_action"    : "search",
    "event_label"     : "q=stopwatch",
    "event_value"     : "null",
    "timestamp"       : "6712375127"
}]				 

Definition

  1. user_id : id of user
  2. user_agent : user agent
  3. user_ip : ip address
  4. client_type : web | mobile
  5. source : where event is being performed. It is "sugarizer" as default and "activityID" when tracking is performed inside an activity.
  6. event_object : parts of pages that we want visitors to interact with
  7. event_action : type of event
  8. event_label : used to identify specific activity
  9. event_value : data assiciated with event
  10. timestamp : timestamp

Routes

//multiple log entry can be inserted at the same time
"[POST]"   /api/v1/stats
 
//fetch log entry from database
"[GET]"    /api/v1/stats?params=xxxx......

//to get all unique users with ip which can be used to plot users over the world map
"[GET]"    /api/v1/stats?fields=uid,ip&unique=true

---------------------------------
list of params for GET request
---------------------------------
uid   : user id
stime : start time (default : timestamp - 10yrs)
etime : end time (default : current timestamp)
event_object : event_object
event_action : event_action
unique : true/false (get unique data)

Events List

This strikes to the end of Community Bonding Period and beginning of the code period.

Let the Coding Begin :)

Clone this wiki locally