Skip to content

open source iOS, OSX application metrics collection with NodeJS Server

License

Notifications You must be signed in to change notification settings

kilik52/UserDataCollectionSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UserDataCollectionSystem

open source iOS, OSX application metrics collection with NodeJS(with mongoDB) Server

THIS REPO IS UNDER CONSTRUCTION!

For iOS version, only support for ios 6.0 or above, ARC mode. And you must have a server to receive data.
The System wraps data as a json format and sends data to your own server through POST request.

Usage:

  1. For iOS, Import all file under iosUserDataCollectionSystem/ directory into your project.
  2. Add following framework:
    • SystemConfiguration.framework
    • CoreTelephony.framework
    • Adsupport.framework
  3. In AppDelegate.m
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    
    Add
    [UDCSystem registerWithServerUrl:@"http://xxxxx/xxx" secret:@"DJSOFINOVIOOXNOEI34234"]; 
    
    The serverUrl parameter is the request url of your data collection server.
    The secret parameter let server to verify incoming data to avoid fraud attack.
  4. To record event, call:
    [UDCSystem event:@"xxxx"]; 
    

DONE!

Tracking Data

This data collection system collects:

  • UUID (use ios advertisingIdentifier)
  • iOS Version
  • Device Info
  • local time zone : it's only used for ref. You may want to use the IP address recorded by the server to determine the user city.
  • App Version
  • Carrier
  • Reachability : it's dynamic , so we use event to record it

Sending Data format

The system send a JSON data every time an event fires.
The JSON file format:

{  
  "Secret" : "DJSOFINOVIOOXNOEI34234",  
  "OS" : "iOS",  
  "OSVersion" : "7.0",  
  "Device" : "Simulator",  
  "UUID" : "99E02D99-91FD-4D54-A59E-BF8CC582160D",  
  "AppVersion" : "1.0",  
  "Carrier" : "None",  
  "UDCSystemVersion" : "1.0",  
  "EventName" : "SDidBecomeActiveNotification",  
  "EventFireTimeLocal" : "2013-09-20 16:53:49",  
  "LocalTimeZone" : "Asia\/Shanghai"  
}

If the Name of the Event start with 'S', that means it's a system event, generated by system.
If the Name of the Event start with 'U', that means it's a user event, generated by user.

If you call

[UDCSystem event:@"UserEvent1"]; 

It will generate a event like this:

{  
  ...  
  "EventName" : "UUserEvent1",  
  "EventFireTimeLocal" : "2013-09-11 15:30:57"  
  ...  
}

So it will send the server a JSON like this:

{  
  "Secret" : "DJSOFINOVIOOXNOEI34234",  
  "OS" : "iOS",  
  "OSVersion" : "7.0",  
  "Device" : "Simulator",  
  "UUID" : "99E02D99-91FD-4D54-A59E-BF8CC582160D",  
  "AppVersion" : "1.0",  
  "Carrier" : "None",  
  "UDCSystemVersion" : "1.0",  
  "EventName" : "SDidBecomeActiveNotification",  
  "EventFireTimeLocal" : "2013-09-20 16:53:49",  
  "LocalTimeZone" : "Asia\/Shanghai"  
}

System Events

  • DidFinishLaunching : fires when app starts
  • DidBecomeActiveNotification : fires when app be active from background
  • DidEnterBackgroundNotification : fires when app enters the background
  • WillTerminateNotification : fires when app terminates
  • Reachability:xxx : fires when reachability changes

Track Page Events

We have a class name UDCBaseViewController to track page events.
To use that, subclass UDCBaseViewController in your view controller class.
By default, UDCBaseViewController will use the view.title to track name of the page.
If self.title is not appropriate for tracking, you can set self.udcTitle variable to use for page tracking.
For ones do not like subclassing, you can call

[UDCSystem pageAppear:@"name_of_page"];
[UDCSystem pageDisappear:@"name_of_page"];

in function:

- (void)viewDidAppear:(BOOL)animated  
- (void)viewDidDisappear:(BOOL)animated  

Page Events format

We fire a event each time a page appears/disappears in

- (void)viewDidAppear:(BOOL)animated  
- (void)viewDidDisappear:(BOOL)animated  

The event name starts for 'P', and adding a 'A' for appear event, 'D' for disappear event.
For example, if a page name viewcontroller1 appears, we fire a event like this:

{  
  ...  
  "EventName" : "PAviewcontroller1",  
  "EventFireTimeLocal" : "2013-09-20 16:53:49"  
  ...  
}

If that page disappears, we fire a event like this:

{  
  ...  
  "EventName" : "PDviewcontroller1",  
  "EventFireTimeLocal" : "2013-09-20 17:53:49"  
  ...  
}

About

open source iOS, OSX application metrics collection with NodeJS Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published