{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Recording Your App's Events and Attributes","type":"basic","slug":"recording-custom-events-and-attributes","excerpt":"","body":"PushSpring's segmentation functionality allows you to easily group users by what actions they take within your application.  The following methods are available on the **\\[PushSpring sharedPushSpring\\]** object for recording additional information about your app users actions within your application.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Increase Customer Lifetime Value\"\n}\n[/block]\nIncrease the stored Customer Lifetime Value for this user, for later segmentation. This value is sent in cents, i.e. if the user makes an in-app purchase for $1.99, you should send [NSNumber numberWithInt:199].\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) increaseCustomerLifetimeValue:(NSNumber *)value;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set Customer Id\"\n}\n[/block]\nIf your app has a customer identifier (perhaps a user id that identifies the user to a backend server), you can associate it with the current user in the PushSpring dashboard.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) setCustomerId:(NSString *)customerId;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set Customer Birth Year\"\n}\n[/block]\nIf you know the users' birth year, you can send it to us here.  It should be the full four digit year.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) setCustomerBirthYear:(NSNumber *)birthYear;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set Customer Gender\"\n}\n[/block]\nIf your app is connected to Facebook or knows the users' gender, you can send it to us here.  There are predefined PS_GENDER_MALE and PS_GENDER_FEMALE values to send in.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) setCustomerGender:(NSString *)gender;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Record Event\"\n}\n[/block]\nRecord a custom event for later segmentation along with an incrementing value.  These custom events will be displayed in the segment editor on the PushSpring dashboard.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) recordEvent:(NSString *)eventName; // Increments by 1\\n- (void) recordEvent:(NSString *)eventName incrementBy:(NSNumber *)value;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":true,"sync_unique":"","link_url":"","link_external":false,"_id":"5dd81acdb8c91603c41dfec9","user":"55de06e19db51a0d0064947d","category":{"sync":{"isSync":false,"url":""},"pages":["5dd81acdb8c91603c41dfec8","5dd81acdb8c91603c41dfec9","5dd81acdb8c91603c41dfeca","5dd81acdb8c91603c41dfecb","5dd81acdb8c91603c41dfecc","5dd81acdb8c91603c41dfecd","5dd81acdb8c91603c41dfece","5dd81acdb8c91603c41dfecf","5dd81acdb8c91603c41dfed0","5dd81acdb8c91603c41dfed2","5dd81acdb8c91603c41dfed5","5dd81acdb8c91603c41dfed6","5dd81acdb8c91603c41dfee1","5dd81acdb8c91603c41dfee3","5dd81acdb8c91603c41dfee7"],"title":"iOS SDK","slug":"ios-sdk","order":1,"from_sync":false,"reference":false,"_id":"5dd81acdb8c91603c41dfebb","version":"5dd81acdb8c91603c41dff08","__v":15,"createdAt":"2015-09-10T14:39:42.948Z","project":"55de06fa57f7b20d0097636b"},"createdAt":"2015-09-10T15:05:10.907Z","parentDoc":null,"version":{"version":"2.0","version_clean":"2.0.0","codename":"PostSDK","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5dd81acdb8c91603c41dfeba","5dd81acdb8c91603c41dfebb","5dd81acdb8c91603c41dfebc","5dd81acdb8c91603c41dfebd","5dd81acdb8c91603c41dfebe","5dd81acdb8c91603c41dfebf","563cbfe4260dde0d00c5e9d4","5dd81acdb8c91603c41dfec0","5dd81acdb8c91603c41dfec1","5dd81acdb8c91603c41dfec2","5dd81acdb8c91603c41dfec3","5dd81acdb8c91603c41dfec4","5dd81acdb8c91603c41dfec5","5dd81acdb8c91603c41dfec6"],"_id":"5dd81acdb8c91603c41dff08","project":"55de06fa57f7b20d0097636b","__v":0,"forked_from":"55de06fa57f7b20d0097636e","createdAt":"2015-08-26T18:35:38.642Z","releaseDate":"2015-08-26T18:35:38.642Z"},"__v":8,"githubsync":"","project":"55de06fa57f7b20d0097636b"}

Recording Your App's Events and Attributes


PushSpring's segmentation functionality allows you to easily group users by what actions they take within your application. The following methods are available on the **\[PushSpring sharedPushSpring\]** object for recording additional information about your app users actions within your application. [block:api-header] { "type": "basic", "title": "Increase Customer Lifetime Value" } [/block] Increase the stored Customer Lifetime Value for this user, for later segmentation. This value is sent in cents, i.e. if the user makes an in-app purchase for $1.99, you should send [NSNumber numberWithInt:199]. [block:code] { "codes": [ { "code": "- (void) increaseCustomerLifetimeValue:(NSNumber *)value;", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Set Customer Id" } [/block] If your app has a customer identifier (perhaps a user id that identifies the user to a backend server), you can associate it with the current user in the PushSpring dashboard. [block:code] { "codes": [ { "code": "- (void) setCustomerId:(NSString *)customerId;", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Set Customer Birth Year" } [/block] If you know the users' birth year, you can send it to us here. It should be the full four digit year. [block:code] { "codes": [ { "code": "- (void) setCustomerBirthYear:(NSNumber *)birthYear;", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Set Customer Gender" } [/block] If your app is connected to Facebook or knows the users' gender, you can send it to us here. There are predefined PS_GENDER_MALE and PS_GENDER_FEMALE values to send in. [block:code] { "codes": [ { "code": "- (void) setCustomerGender:(NSString *)gender;", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Record Event" } [/block] Record a custom event for later segmentation along with an incrementing value. These custom events will be displayed in the segment editor on the PushSpring dashboard. [block:code] { "codes": [ { "code": "- (void) recordEvent:(NSString *)eventName; // Increments by 1\n- (void) recordEvent:(NSString *)eventName incrementBy:(NSNumber *)value;", "language": "objectivec" } ] } [/block]