{"_id":"55f1b6215fe76419007dc760","user":"55de06e19db51a0d0064947d","parentDoc":null,"project":"55de06fa57f7b20d0097636b","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":1,"category":{"_id":"55f1970339e3e8190068b2b8","pages":["55f1a1e6229b772300779a34","55f1b11b39e3e8190068b2f1","55f1b59b39e3e8190068b2fc","55f1b6215fe76419007dc760","55f1b69539e3e8190068b2fe","55f1b90a5fe76419007dc763","55f1b93ffd98c42300acc643"],"project":"55de06fa57f7b20d0097636b","version":"55de06fa57f7b20d0097636e","__v":7,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-10T14:43:15.288Z","from_sync":false,"order":2,"slug":"android-sdk","title":"Android SDK"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-10T16:56:01.390Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"You can use PushSpring data inside your application to customize the content you show to users. This data includes Personas and Gender.  You could present a different registration experience based on Gender or feature different ads based on personas.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Getting Content Customization Data\"\n}\n[/block]\nContent customization data requires a round trip to the PushSpring servers to map signals to the customization data. The call to retrieve the data is asynchronous and requires you to implement an interface, PSRealtimeCustomerInsights, to receive the results.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class MainActivity extends Activity implements com.pushspring.sdk.PSRealtimeCustomerInsights {\\n \\n  public void RealtimeCustomerInsightsResults(HashMap<String, Object> results) {\\n    String status = (String) results.get(\\\"status\\\");\\n    LinkedTreeMap<String, Object> responses = (LinkedTreeMap<String, Object>) results.get(\\\"responses\\\");\\n    ArrayList<String> personas = (ArrayList<String>) responses.get(\\\"personas\\\");\\n\\n    TextView textView = (TextView) findViewById(R.id.text);\\n    textView.append(\\\"\\\\r\\\\nRealtime results status: \\\" + status + \\\"\\\\r\\\\n\\\");\\n\\n    for (String persona : personas) {\\n      textView.append(String.format(\\\"Persona id: %s found\\\\r\\\\n\\\", persona));\\n    }\\n  }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Data Elements\"\n}\n[/block]\nThe returned data is a hierarchical JSON structure which is mapped to a HashMap.  Additional elements may be added to\nthe responses map over time.\n\n####status\nIf the call succeeds and valid data is returned this String will be 'OK'.  'ERROR' will be returned if there was a\nproblem with the backend.\n\n####responses.personas\nThis is an array of persona IDs. You can download a mapping of persona ids to names [here](https://api.pushspring.com/v1/personas).\n\n####responses.gender\nThis is a String indicating the gender of the user.  'M' = Male, 'F' = Female, 'U' = Unknown.\n\n####responses.age\nThis is an Integer indicating the age range of the user of the device.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"0\",\n    \"0-1\": \"Unknown\",\n    \"h-0\": \"Value\",\n    \"h-1\": \"Range\",\n    \"1-0\": \"1\",\n    \"1-1\": \"18 - 24\",\n    \"2-0\": \"2\",\n    \"2-1\": \"25 - 34\",\n    \"3-0\": \"3\",\n    \"3-1\": \"35 - 44\",\n    \"4-0\": \"4\",\n    \"4-1\": \"45 - 54\",\n    \"5-0\": \"5\",\n    \"5-1\": \"55 - 64\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n####responses.medianAge\nThis is the median of the age range the user of the device falls into.\n\n###responses.income\nThis is an Integer indicating the income range of the user of the device.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Value\",\n    \"h-1\": \"Range\",\n    \"0-0\": \"0\",\n    \"0-1\": \"Unknown\",\n    \"1-0\": \"1\",\n    \"1-1\": \"Under $25,000\",\n    \"2-0\": \"2\",\n    \"2-1\": \"$25,000 - $39,999\",\n    \"3-0\": \"3\",\n    \"3-1\": \"$40,000 - $59,999\",\n    \"4-0\": \"4\",\n    \"4-1\": \"$60,000 - $74,999\",\n    \"5-0\": \"5\",\n    \"5-1\": \"$75,000 - $100,000\",\n    \"6-0\": \"6\",\n    \"6-1\": \"Over $100,000\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]\n####responses.medianIncome\nThis is the median of the income range the user of the device falls into.","excerpt":"Customize the content you show to users","slug":"content-customization-1","type":"basic","title":"Content Customization"}

Content Customization

Customize the content you show to users

You can use PushSpring data inside your application to customize the content you show to users. This data includes Personas and Gender. You could present a different registration experience based on Gender or feature different ads based on personas. [block:api-header] { "type": "basic", "title": "Getting Content Customization Data" } [/block] Content customization data requires a round trip to the PushSpring servers to map signals to the customization data. The call to retrieve the data is asynchronous and requires you to implement an interface, PSRealtimeCustomerInsights, to receive the results. [block:code] { "codes": [ { "code": "public class MainActivity extends Activity implements com.pushspring.sdk.PSRealtimeCustomerInsights {\n \n public void RealtimeCustomerInsightsResults(HashMap<String, Object> results) {\n String status = (String) results.get(\"status\");\n LinkedTreeMap<String, Object> responses = (LinkedTreeMap<String, Object>) results.get(\"responses\");\n ArrayList<String> personas = (ArrayList<String>) responses.get(\"personas\");\n\n TextView textView = (TextView) findViewById(R.id.text);\n textView.append(\"\\r\\nRealtime results status: \" + status + \"\\r\\n\");\n\n for (String persona : personas) {\n textView.append(String.format(\"Persona id: %s found\\r\\n\", persona));\n }\n }\n}", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "Data Elements" } [/block] The returned data is a hierarchical JSON structure which is mapped to a HashMap. Additional elements may be added to the responses map over time. ####status If the call succeeds and valid data is returned this String will be 'OK'. 'ERROR' will be returned if there was a problem with the backend. ####responses.personas This is an array of persona IDs. You can download a mapping of persona ids to names [here](https://api.pushspring.com/v1/personas). ####responses.gender This is a String indicating the gender of the user. 'M' = Male, 'F' = Female, 'U' = Unknown. ####responses.age This is an Integer indicating the age range of the user of the device. [block:parameters] { "data": { "0-0": "0", "0-1": "Unknown", "h-0": "Value", "h-1": "Range", "1-0": "1", "1-1": "18 - 24", "2-0": "2", "2-1": "25 - 34", "3-0": "3", "3-1": "35 - 44", "4-0": "4", "4-1": "45 - 54", "5-0": "5", "5-1": "55 - 64" }, "cols": 2, "rows": 6 } [/block] ####responses.medianAge This is the median of the age range the user of the device falls into. ###responses.income This is an Integer indicating the income range of the user of the device. [block:parameters] { "data": { "h-0": "Value", "h-1": "Range", "0-0": "0", "0-1": "Unknown", "1-0": "1", "1-1": "Under $25,000", "2-0": "2", "2-1": "$25,000 - $39,999", "3-0": "3", "3-1": "$40,000 - $59,999", "4-0": "4", "4-1": "$60,000 - $74,999", "5-0": "5", "5-1": "$75,000 - $100,000", "6-0": "6", "6-1": "Over $100,000" }, "cols": 2, "rows": 7 } [/block] ####responses.medianIncome This is the median of the income range the user of the device falls into.