{"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":"custom-events-and-attributes-a","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.\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\": \"public void increaseCustomerLifetimeValue(final int cents);\",\n      \"language\": \"java\"\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\": \"public void setCustomerId(final String customerId);\",\n      \"language\": \"java\"\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\": \"public void setCustomerBirthYear(final Integer birthYear);\",\n      \"language\": \"java\"\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\": \"public void setCustomerGender(final String gender);\",\n      \"language\": \"java\"\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.  For instance, you might store that the user has completed Level 9 in a game, or that they've viewed a particular area of content.  These custom events will be displayed in the segment editor on the PushSpring dashboard.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public void recordEvent(final String eventName);\\npublic void recordEvent(final String eventName, final int increasedBy);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","updates":[],"order":2,"isReference":false,"hidden":true,"sync_unique":"","link_url":"","link_external":false,"_id":"5dd81acdb8c91603c41dfed2","__v":4,"category":{"sync":{"isSync":false,"url":""},"pages":["5dd81acdb8c91603c41dfed1","55f1b11b39e3e8190068b2f1","5dd81acdb8c91603c41dfed3","5dd81acdb8c91603c41dfed4","55f1b69539e3e8190068b2fe","5dd81acdb8c91603c41dfed7","55f1b93ffd98c42300acc643"],"title":"Android SDK","slug":"android-sdk","order":2,"from_sync":false,"reference":false,"_id":"5dd81acdb8c91603c41dfebc","project":"55de06fa57f7b20d0097636b","version":"5dd81acdb8c91603c41dff08","createdAt":"2015-09-10T14:43:15.288Z","__v":7},"user":"55de06e19db51a0d0064947d","githubsync":"","project":"55de06fa57f7b20d0097636b","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"},"createdAt":"2015-09-10T16:41:34.713Z","parentDoc":null}

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. [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": "public void increaseCustomerLifetimeValue(final int cents);", "language": "java" } ] } [/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": "public void setCustomerId(final String customerId);", "language": "java" } ] } [/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": "public void setCustomerBirthYear(final Integer birthYear);", "language": "java" } ] } [/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": "public void setCustomerGender(final String gender);", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Record Event" } [/block] Record a custom event for later segmentation. For instance, you might store that the user has completed Level 9 in a game, or that they've viewed a particular area of content. These custom events will be displayed in the segment editor on the PushSpring dashboard. [block:code] { "codes": [ { "code": "public void recordEvent(final String eventName);\npublic void recordEvent(final String eventName, final int increasedBy);", "language": "java" } ] } [/block]