Instructions for Mac OS (Xcode)

Thank you for choosing Software Statistics Service – a perfect tool Mac OS applications!

These instructions will help you to install and integrate Software Statistics Service tracker into your Mac OS application within a few minutes. If you experience any problems, please consult online documentation. And please don’t hesitate to contact us – we’re always glad to help.

Please see instructions for other technologies: .NETC++, Java, Java for AndroidDelphiMicrosoft SilverlightWindows Phone 7Windows Presentation Foundation,   iOS (Xcode) .

Technical Requirements

XCode 4 or newer
Mac OS X 10.6 or newer

Integration

  • Include header file SoftwareStatisticsService.h in your code
  • Link to Software Statistics Service library (if you are using dynamic library also copy it to /usr/local/lib/)

Usage

1. To initialize the Software Statistics Manager use the code below when the application is started

#import "SoftwareStatisticsService.h"
// register notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ExceptionEventNotif:) name:kExceptionEventNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TrackerSettingsReceivedNotif:) name:kTrackerSettingsReceived object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(EventDataSentAndResponseNotif:) name:kEventDataSentAndResponse object:nil];
// initialized parameters
SoftwareStatisticsInitParams* InitParams = [[SoftwareStatisticsInitParams alloc] init];
InitParams.ProductKey = PRODUCTKEY;
InitParams.ProductName = PRODUCTNAME;
InitParams.ProductVendor = PRODUCTVENDOR;
SSProductVersion* pV = [[SSProductVersion alloc] initWithMajor:0 Minor:0 Release:0 andBuild:1];// product version
InitParams.ProductVersion = pV;
[pV release];
InitParams.ProductPackage = PRODUCTPACKAGE;
InitParams.UseSandbox = NO;//or YES
InitSoftwareStatisticsManager(InitParams);// initialize SoftwareStatisticsManager
[InitParams release];

2. To start SoftwareStatisticsManager execute the following call:

[GetSoftwareStatisticsManager() AppStart];

3. Use the code below when you want to add some events without parameters or with one or more parameters

id eve = CreateEvent(@"sample event", 0);// 0 for current date
	[eve AddParam:@"string parameter name" valueString:@"parameter value"];
	[eve AddParam:@"numeric parameter name" valueInt:1];
	[eve AddLog:@"log parameter name" value:@"log string"];
	[eve AddException:@"exception parameter name" value:@"exception string"];
[GetSoftwareStatisticsManager() AddCustomEvent:eve];

4. Use the below code before application is finished:

[GetSoftwareStatisticsManager() AppFinish];
DeinitSoftwareStatisticsManager();// deinitialize SoftwareStatisticsManager.
// unregister notifications
	[[NSNotificationCenter defaultCenter] removeObserver:self name:kExceptionEventNotification object:nil];
	[[NSNotificationCenter defaultCenter] removeObserver:self name:kTrackerSettingsReceived object:nil];
	[[NSNotificationCenter defaultCenter] removeObserver:self name:kEventDataSentAndResponse object:nil];

5. You can implement the function to get notifications:

- (void)ExceptionEventNotif:(NSNotification *)notification
	{
		NSString *excepText = [notification object];
		NSString* mess = [NSString stringWithFormat:@"Exception: %@", excepText];
		NSLog(@"%@", mess);
	}
 
	- (void)TrackerSettingsReceivedNotif:(NSNotification *)notification
	{
		NSString *settingsText = [notification object];
		NSString* mess = [NSString stringWithFormat:@"TrackerSettings: %@", settingsText];
		NSLog(@"%@", mess);
	}
 
	- (void)EventDataSentAndResponseNotif:(NSNotification *)notification
	{
		NSString* eventDataXML = [[notification userInfo] objectForKey:kEventDataXML];
		NSString* responseText = [[notification userInfo] objectForKey:kResponseText];
		NSString* mess = [NSString stringWithFormat:@"SendEventData size=%d, response=%@", [eventDataXML length], responseText];
		NSLog(@"%@", mess);
	}

Note: Software Statistics Service Tracker is designed to automatically collect anonymous usage information and transfer it to the Software Statistics Service host server. In addition this service allows you to collect your own custom data that may not be anonymous and violate user level agreement and country laws. You should include prominent option in your software informing users about such behaviour and allowing them to turn this feature off. Usual practice is to show such option during software installation and also add it to the software program options/preferences.

How to Test Your Integration

  1. Signup at software-statistics-service.com and create a new project.
  2. Create a new application and use Software Statistics Service Tracker client module in it as it is described in integration instructions.
  3. Copy Project Key from your account and set Project Key property of tracker module in your application.
  4. Make sure you’ve set UseSandbox property to “True”. When this option is used your data will be posted to our sandbox server which is faster but limited by the number of requests – up to 100 requests per project per day. In case you were trying integration and reached the limit you should create a new project and use another Project Key.

The very simple way to test is to run and then close your application. Software Statistics Service Tracker module will send data when application is about to be closed. If there are delays/troubles with internet connection, it will try to send data next time application is started.

Usually it takes up to 15 minutes between data transfer to the server and the moment when you can see them on the graphs under your account.

By default Tracker module collects such events as application start and shutdown as well as such data as RAM amount, number of CPU cores and CPU frequency, location and operating system i.e. very common usage information. If you want to track your own data e.g. number of times a button was clicked or feature was used you should use Custom Events.

Changelog

Check out our changelog for Mac OS from time to time to follow up with our latest updates.

Frequently Asked Questions

See also  Frequently Asked Questions
We are open to your suggestions and ready to discuss your needs and ideas at: support@software-statistics-service.com

Thank you for reading this far. Good luck with your e-business!

This component is copyrighted (c) 2010-2011 MagneticOne, Eleks
All trademarks are property of their respective owners.