Skip to content

Instantly share code, notes, and snippets.

@kohiomobz
Created July 30, 2015 19:43
Show Gist options
  • Save kohiomobz/c37af4f8fdfe65e857c6 to your computer and use it in GitHub Desktop.
Save kohiomobz/c37af4f8fdfe65e857c6 to your computer and use it in GitHub Desktop.
First App Launch
// Let’s check if we have a firstLaunch property inside NS Standard Defaults - if not, let’s set first app launch to YES
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]){
NSDictionary *appLaunchProperties = @{@"first app launch" : @YES};
[[Mixpanel sharedInstance] track:@"App Launched" properties:appLaunchProperties];
[[Mixpanel sharedInstance] registerSuperProperties:appLaunchProperties];
[[Mixpanel sharedInstance].people set:@{@"First App Launch": [NSDate date]}];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLaunch"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else {
// Otherwise set first app launch to NO
[[Mixpanel sharedInstance] registerSuperProperties:@{@"first app launch" : @NO}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment