views:

85

answers:

2

I would like to be able to gather info like how often certain windows are opened, what types of user data are accessed, how often menu items are clicked, etc. Does anyone know of a 3rd party (open source or commercial) Cocoa/Obj-C library or plugin that would allow me to gather this info?

+1  A: 

I have used pinch media in the past, and they merged with Flurry. Library was simple to use and was setup in around 40 minutes.

Brian King
That seems to be for Cocoa Touch apps, not Cocoa apps.
Peter Hosey
Hrm, that's interesting, I guess they use UIKit to monitor some times...This is another package I saw, again it's iPhone based, but modifying it to work on the mac would be easy.http://code.google.com/p/bkxititag
Brian King
Yeah, it'll be good if Flurry open-source their library or makes it available also for the Mac.
adib
+1  A: 

I don't know any library for that but at least to get informed about when the user switches the front application you can install an event handler like this:

EventTypeSpec eventType;
eventType.eventClass = kEventClassApplication;
eventType.eventKind  = kEventAppFrontSwitched;
EventHandlerUPP handlerUPP = NewEventHandlerUPP(FrontAppSwitchedDetector_callback);
OSStatus status=InstallApplicationEventHandler(handlerUPP,1,&eventType,self,&_eventHandlerRef);

... and when receiving an callback you may get the current front application process:

pascal OSStatus FrontAppSwitchedDetector_callback(EventHandlerCallRef nextHandler,EventRef theEvent,void* userData)
{
    ProcessSerialNumber newSerial;
    GetFrontProcess(&newSerial);
    //to something with that ....
    return (CallNextEventHandler(nextHandler, theEvent));
}
Robert