Tracking Users
Whenever you release a product it is important to measure how you are doing in terms of adoption. Unfortunately the number of downloads is a very bad metric. Just because someone
downloaded the application does not mean that he is actually using it. And someone could download the application multiple times and so on. All my Cocoa applications are using Sparkle for software updates. It’s the one time where all of your
users check back on your server. So the idea was simple: just let’s include a unique identifier with the software update check and we are golden.
The new Sparkle 1.5 is still beta but already more than usable. In fact it now provides the proper delegate methods to send information
along with the appcast update check. Somewhere in your code you will have to set the delegate
[[SUUpdater sharedUpdater] setDelegate:self];
and when Sparkle checks for a new release it will send a long the UUID we generate for the installation.
- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile { NSArray *keys = [NSArray arrayWithObjects:@"key", @"value", nil]; NSArray *parameters = [NSArray arrayWithObject: [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: @"installationId", [self installationId], nil] forKeys:keys]]; return parameters; }
The installation id gets generated once and then stored inside the user defaults.
- (NSString*)installationId { NSString *uuid = [[NSUserDefaults standardUserDefaults] valueForKey:INSTALLATIONID]; if (uuid == nil) { uuid_t buffer; char str[37]; uuid_generate(buffer); uuid_unparse_upper(buffer, str); uuid = [NSString stringWithFormat:@"%s", str]; NSLog(@"Generated UUID %@", uuid); [[NSUserDefaults standardUserDefaults] setValue: uuid forKey: INSTALLATIONID]; } return uuid; }
When you now grep and analyze your server http log files you can easily figure out how many individual installations are out there. The id is entirely random and therefor should not be a problem in terms of privacy. Keep in mind thought that Sparkle will check for releases only every few days. And your application must have been started. So there can be quite a delay. Still you have a much better metric and know much more precise how many users you are dealing with.
While you can implement this yourself in all of your applications I thought this might be worth being part of Sparkle itself. The changes are available in my Sparkle branch on launchpad. Unfortunately it will probably not make it into the 1.5 release. But poke Andy if you think this would be a useful addition :)