{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Custom Attributes","type":"basic","slug":"passing-custom-parameters-to-pulsate-1","excerpt":"","body":"[block:api-header]\n{\n  \"title\": \"Creating Attributes\"\n}\n[/block]\nIn addition to the system attributes that Pulsate collects on your customers, you can optionally pass an unlimited amount of of custom attributes as well. This can be useful for collecting additional data on specific users such as: if they have made a purchase within the App yet, what plan they are on, free / paid etc.\n\nAny custom attribute that you pass to Pulsate automatically appears has a new filter option within the segment builder. Meaning that you can use a combination of our system filters such as \"last active / number of sessions\" combined with custom filters.\n\nSo for example you could build a segment around the following conditions: Show me users that - were last active less than 1 week ago - and where - number of purchases - is more than - 2. by combining Pulsate's system filter options with dynamic filters (created based on your custom parameters) we can create very granular segments, and thus create highly relevant and targeted campaigns.\n\nWhen you send a custom attribute to Pulsate, you need to let us know what data type it is so that Pulsate knows what segmentation options to present you with. For instance, if you send us a date, we will display options related to that date whereas a for a boolean we will display true or false as the only segment options. \n\nTo set a custom property simply invoke the *createAttribute:withValue* method:\n\nString: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager createAttribute::::at:::\\\"Property\\\" withString:@\\\"value\\\"]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager?.createAttribute(\\\"Property\\\", with: \\\"value\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nFloat: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager createAttribute:@\\\"Property\\\" withFloat:2.0]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager?.createAttribute(\\\"Property\\\", with: 2.0)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nInteger:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager createAttribute:@\\\"Property\\\" withInteger:2]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager?.createAttribute(\\\"Property\\\", with: 2)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nBoolean:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager createAttribute:@\\\"Property\\\" withBoolean:YES]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager?.createAttribute(\\\"Property\\\", withBoolean: true)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nDate - the format of the Date that is sent to the server is - yyyy-MM-dd HH:mm:ss, the timezone is UTC.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager createAttribute:@\\\"Property\\\" withDate:[NSDate date]]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager?.createAttribute(\\\"Property\\\", with: NSDate())\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Incrementing / Decrementing Custom Attributes\"\n}\n[/block]\nWe also give you the ability to increment / decrement custom attributes.\nThis is useful in situations where you want to increase / decrease a value without knowing it's current value.\n\nIncrementing:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager incrementIntegerAttribute:@\\\"number_of_transactions\\\" withInteger:1]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager.incrementIntegerAttribute(\\\"number_of_transactions\\\", withInteger: 1)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nThis will increment the counter named clickCounter by 1. If the counter will be incremented for the first time, it will be created and initialized with 0 value, then incremented by 1.\n\nIncrement value can be positive as well as negative. If a negative value is given i.e. -1, it will act as decrement by 1.\n\nDecrementing:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[pulsateManager decrementIntegerAttribute:@\\\"number_of_transactions\\\" withInteger:1]\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager.decrementIntegerAttribute(\\\"number_of_transactions\\\", withInteger: 1)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nWill decrement counter named clickCounter by 2, if counter is decremented for the first time, it will be created and initialized with 0 value, then decremented by 2.\n\nDecrement value can be positive as well as negative. If negative value is given i.e. -1, it will act as increment by 1.","updates":[],"order":2,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5f44d5a80e1f03020988b396","createdAt":"2020-08-25T09:11:04.254Z","user":"57bc3654b9c7f0220009c77b","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"SDK Basic","slug":"sdk-basic","order":2,"from_sync":false,"reference":false,"_id":"5f44d202a2e3eb02b1c4c806","createdAt":"2020-08-25T08:55:30.447Z","version":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","__v":0},"version":{"version":"2.7","version_clean":"2.7.0","codename":"iOS SDK","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e5013741b3b200065329486","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","5e5013741b3b200065329487","5e5013741b3b200065329488","5e5013741b3b200065329489","5e5013741b3b20006532948a","5e5013741b3b20006532948b","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","5e5013741b3b20006532948c","5e5013741b3b20006532948d","5c73dd27e8fdc000572a206a","5e5013741b3b20006532948e","5e53d9a2f75c0b0020de8935","5f44d1fbd1c58d040fdf03ba","5f44d202a2e3eb02b1c4c806","5f44d209703f05006a2a4fa9","5f44d210b1ba9f004200b689"],"_id":"5e5013741b3b20006532951d","project":"54aa7f773b56130b0056c86e","forked_from":"5e4fbbbda8fb41028f1861fe","__v":5,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z"},"project":"54aa7f773b56130b0056c86e","__v":0,"parentDoc":null}
[block:api-header] { "title": "Creating Attributes" } [/block] In addition to the system attributes that Pulsate collects on your customers, you can optionally pass an unlimited amount of of custom attributes as well. This can be useful for collecting additional data on specific users such as: if they have made a purchase within the App yet, what plan they are on, free / paid etc. Any custom attribute that you pass to Pulsate automatically appears has a new filter option within the segment builder. Meaning that you can use a combination of our system filters such as "last active / number of sessions" combined with custom filters. So for example you could build a segment around the following conditions: Show me users that - were last active less than 1 week ago - and where - number of purchases - is more than - 2. by combining Pulsate's system filter options with dynamic filters (created based on your custom parameters) we can create very granular segments, and thus create highly relevant and targeted campaigns. When you send a custom attribute to Pulsate, you need to let us know what data type it is so that Pulsate knows what segmentation options to present you with. For instance, if you send us a date, we will display options related to that date whereas a for a boolean we will display true or false as the only segment options. To set a custom property simply invoke the *createAttribute:withValue* method: String: [block:code] { "codes": [ { "code": "[pulsateManager createAttribute:@\"Property\" withString:@\"value\"]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager?.createAttribute(\"Property\", with: \"value\")", "language": "swift" } ] } [/block] Float: [block:code] { "codes": [ { "code": "[pulsateManager createAttribute:@\"Property\" withFloat:2.0]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager?.createAttribute(\"Property\", with: 2.0)", "language": "swift" } ] } [/block] Integer: [block:code] { "codes": [ { "code": "[pulsateManager createAttribute:@\"Property\" withInteger:2]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager?.createAttribute(\"Property\", with: 2)", "language": "swift" } ] } [/block] Boolean: [block:code] { "codes": [ { "code": "[pulsateManager createAttribute:@\"Property\" withBoolean:YES]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager?.createAttribute(\"Property\", withBoolean: true)", "language": "swift" } ] } [/block] Date - the format of the Date that is sent to the server is - yyyy-MM-dd HH:mm:ss, the timezone is UTC. [block:code] { "codes": [ { "code": "[pulsateManager createAttribute:@\"Property\" withDate:[NSDate date]]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager?.createAttribute(\"Property\", with: NSDate())", "language": "swift" } ] } [/block] [block:api-header] { "title": "Incrementing / Decrementing Custom Attributes" } [/block] We also give you the ability to increment / decrement custom attributes. This is useful in situations where you want to increase / decrease a value without knowing it's current value. Incrementing: [block:code] { "codes": [ { "code": "[pulsateManager incrementIntegerAttribute:@\"number_of_transactions\" withInteger:1]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager.incrementIntegerAttribute(\"number_of_transactions\", withInteger: 1)", "language": "swift" } ] } [/block] This will increment the counter named clickCounter by 1. If the counter will be incremented for the first time, it will be created and initialized with 0 value, then incremented by 1. Increment value can be positive as well as negative. If a negative value is given i.e. -1, it will act as decrement by 1. Decrementing: [block:code] { "codes": [ { "code": "[pulsateManager decrementIntegerAttribute:@\"number_of_transactions\" withInteger:1]", "language": "objectivec" } ] } [/block] [block:code] { "codes": [ { "code": "pulsateManager.decrementIntegerAttribute(\"number_of_transactions\", withInteger: 1)", "language": "swift" } ] } [/block] Will decrement counter named clickCounter by 2, if counter is decremented for the first time, it will be created and initialized with 0 value, then decremented by 2. Decrement value can be positive as well as negative. If negative value is given i.e. -1, it will act as increment by 1.