{"_id":"55f19c267dccfc0d00986b44","user":"55de06e19db51a0d0064947d","category":{"_id":"55f1962e3936d52d00fb3c8f","version":"55de06fa57f7b20d0097636e","__v":15,"pages":["55f196903936d52d00fb3c95","55f19c267dccfc0d00986b44","55f19da95fe76419007dc732","55f19ea639e3e8190068b2cc","55f19f7c7dccfc0d00986b4b","55f19fff3936d52d00fb3ca1","55f1a06d39e3e8190068b2d2","55f1a0925fe76419007dc737","55f1a0cb3936d52d00fb3cab","55f1b2be7dccfc0d00986b72","55f1b7d139e3e8190068b300","55f1b7fb229b772300779a4a","55f1be1efd98c42300acc64f","560956518aedf50d0004d0e2","565380daf77ca023004e5321"],"project":"55de06fa57f7b20d0097636b","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-10T14:39:42.948Z","from_sync":false,"order":1,"slug":"ios-sdk","title":"iOS SDK"},"parentDoc":null,"version":{"_id":"55de06fa57f7b20d0097636e","project":"55de06fa57f7b20d0097636b","__v":14,"createdAt":"2015-08-26T18:35:38.642Z","releaseDate":"2015-08-26T18:35:38.642Z","categories":["55de06fb57f7b20d0097636f","55f1962e3936d52d00fb3c8f","55f1970339e3e8190068b2b8","55f1970d229b772300779a1f","55f1971cfd98c42300acc605","55f1d5c7fd98c42300acc69f","563cbfe4260dde0d00c5e9d4","5644cf437f1fff210078e690","57dc1bbd3ed3450e00dc9ea7","58a600a2243dd30f00fd8773","58ed1bdc068f780f00f64602","58f13b3a4f0ee50f00e24e81","58f173f792f9020f009cad16","591b42f8e633fd0f00077c5a"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":8,"project":"55de06fa57f7b20d0097636b","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-10T15:05:10.907Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"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\": \"Set Location\"\n}\n[/block]\nAttempt to retrieve the users' location.  Note that this method will NOT result in a user being prompted to allow your app access to location information; it checks to see if your app is already authorized, and if so, sends the data to PushSpring.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) setAvailableLocationInfo;\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set Latitude and Longitude\"\n}\n[/block]\nIf you have a latitude and longitude for the user, you can record it here for later location-based segmentation on the PushSpring dashboard.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void) setLatitude:(double)latitude andLongitude:(double)longitude;\",\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]","excerpt":"","slug":"recording-custom-events-and-attributes","type":"basic","title":"Recording Your App's Events and Attributes"}

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": "Set Location" } [/block] Attempt to retrieve the users' location. Note that this method will NOT result in a user being prompted to allow your app access to location information; it checks to see if your app is already authorized, and if so, sends the data to PushSpring. [block:code] { "codes": [ { "code": "- (void) setAvailableLocationInfo;", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "Set Latitude and Longitude" } [/block] If you have a latitude and longitude for the user, you can record it here for later location-based segmentation on the PushSpring dashboard. [block:code] { "codes": [ { "code": "- (void) setLatitude:(double)latitude andLongitude:(double)longitude;", "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]