{"__v":12,"_id":"55b0cc5cb3171b3700b153fa","category":{"__v":26,"_id":"55a4ff5b2e70c0250038050f","pages":["55a4ff7d750a9a23005332af","55a4ff8b750a9a23005332b1","55a4ff9b750a9a23005332b3","55a60bfcaaf9cf1900114efb","55a6184880c8a30d00b32526","55a61ba780c8a30d00b32532","55a61c97aaf9cf1900114f40","55a61ea9aaf9cf1900114f48","55a6206580c8a30d00b32544","55a64277aaf9cf1900114fc2","55a694d1aaf9cf1900115102","55a6a23eaaf9cf19001151e2","55a6a9b389c9da1900e2a41d","55a6aba45f88a70d0065b255","55a90687c8bd450d000dd157","55af84f3aa902f1700300daa","55afa3e3902fd51700f5f858","55b0cc5cb3171b3700b153fa","56015bdc3aa0520d00da0ced","5603fe3490ee490d004404c2","5633dd18d28a340d004004f5","56448c697a8cb50d00a3ea3f","56d7a2ec5208281500a2506c","56d859b8b159f10b00304577","56d9822add90610b002708a1","56ef44c6e8d6fa17006f244f"],"project":"5540ce1b31827a0d007ab1cc","version":"5540ce1c31827a0d007ab1cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-14T12:23:55.603Z","from_sync":false,"order":2,"slug":"features","title":"Features"},"parentDoc":null,"project":"5540ce1b31827a0d007ab1cc","user":"5540cdbf5cf9682100d61a97","version":{"__v":31,"_id":"5540ce1c31827a0d007ab1cf","project":"5540ce1b31827a0d007ab1cc","createdAt":"2015-04-29T12:27:08.390Z","releaseDate":"2015-04-29T12:27:08.390Z","categories":["5540ce1c31827a0d007ab1d0","5540d91bbb9e762d00f594ad","5540e5f131827a0d007ab212","5540e5febb9e762d00f594d3","5540e61331827a0d007ab213","5540e6195cf9682100d61afa","5540e62631827a0d007ab214","5540e63031827a0d007ab215","5540e63531827a0d007ab216","5540e63e5cf9682100d61afc","5540e6445cf9682100d61afd","5540e64a5cf9682100d61afe","55a4ff5b2e70c0250038050f","55acb28318eefd0d0071d504","55ae1abe8576b92300291c80","55ae453ef302af23000ac109","55af586d555b900d0036d296","55af91dac8a85321007a53c3","55b9fee204775a2f00628071","55b9ff0e04775a2f00628072","55b9ff4604775a2f00628073","55b9ff5fd72d1e1900276a38","55b9ff7f04775a2f00628074","55b9ff90eb08801900f833e5","55b9ffa5d72d1e1900276a39","55b9ffca04775a2f00628075","55b9fffdd72d1e1900276a3a","56bc2f033ee9e70d008b46af","56c2f6efbbf9ec2d00e0fe4f","57595bbb18760817001e8bbe","57d8d9793916800e003dde53"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-23T11:13:32.454Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":17,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Please [contact us](https://pushwoosh.com/contact-us) if you would like to try out this functionality in your apps.\",\n  \"title\": \"Events functionality is currently in beta\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview\"\n}\n[/block]\nEvents are intended to record various actions a user performs in the application.\nUnlike Tags that are used to store flat data (such as country, device model or installation data), event data is stored historically and can be treated as a history of user behaviour rather than a set of information about the device. All the contextual information about the event can be passed as a set of attributes and its values.\n\nOnce properly collected, this data can be used to:\n- trigger certain [In-App Messages](http://pushwoosh.readme.io/docs/in-app-messages) to be displayed;\n- build a segment of users who are eligible to receive an In-App;\n- get insights about user flow in the app, usage metrics, and other statistical data.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Prerequisites\"\n}\n[/block]\nEvent data is valuable only if it's submitted properly. Therefore, we strongly recommend to follow the simple guidelines below:\n- Try to name events as short as possible;\n- Name events after actions a user performs in the app - \"LoggedIn\", \"SignedOut\", \"Subscribed\", etc.;\n- Keep in mind that event names are case-sensitive;\n- Merge events that describe a single action into a single event. I.e., use \"Subscribed\" event with proper attribution rather than separate \"SubscribedToSports\", \"SubscribedToPolitics\", \"SubscribedToTechnology\" events.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Attributes\"\n}\n[/block]\nAll details describing an event are provided with its attributes. All events sent by your application must be created in Pushwoosh first with the set of attributes and their types, otherwise Pushwoosh will not recognise them. All attributes are key/value pairs and can be of 5 different types: integer, string, list, date and boolean.\n\nFor example, you can send a **Login** event when a user logs in, and add details about the type of login credentials (through Facebook, Google+, Twitter or email), internet connection type (wifi, cellular, unknown), and whether it was successful or not (true or false values):\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"type\",\n    \"0-1\": \"string\",\n    \"1-0\": \"connection\",\n    \"2-0\": \"success\",\n    \"1-1\": \"string\",\n    \"2-1\": \"boolean\",\n    \"h-2\": \"value\",\n    \"h-0\": \"attribute\",\n    \"h-1\": \"type\",\n    \"0-2\": \"facebook, google, twitter, email\",\n    \"1-2\": \"wifi, cellular, unknown\",\n    \"2-2\": \"true, false\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Sn6RZ74GROOvqF837BXQ_Pushwoosh___Applications___Demo_application___Events.png\",\n        \"Pushwoosh___Applications___Demo_application___Events.png\",\n        \"584\",\n        \"652\",\n        \"#25981f\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThis event will be recorded in Pushwoosh with attribute values and a timestamp, so later it can be used to build a segment of users who are eligible of receiving a certain In-App Message.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"SDK\"\n}\n[/block]\n## iOS\nWhen an interesting event occurs in your iOS application, use the following instructions to send this event to Pushwoosh.\n\nCall the `postEvent` to send an event to Pushwoosh:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[PushNotificationManager pushManager] postEvent::::at:::“Login” withAttributes:@{}];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\nIn order to add details about the event you should use attributes describing it as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"NSDictionary *attributes = @{ @\\\"AttributeString\\\" : @\\\"someString\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t  @\\\"AttributeInt\\\" : @(42),\\n\\t\\t\\t\\t\\t\\t\\t\\t  @\\\"AttributeList\\\" : @[ @(123), @(456), @\\\"someString\\\" ],\\n\\t\\t\\t\\t\\t\\t\\t\\t  @\\\"AttributeBool\\\" : @YES,\\n\\t\\t\\t\\t\\t\\t\\t\\t  @\\\"AttributeDate\\\" : [NSDate date] };\\n\\n[[PushNotificationManager pushManager] postEvent:@“eventName” withAttributes:attributes];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n## Android\nWhen an interesting event occurs in your Android application, use the following instructions to send this event to Pushwoosh.\n\nCall the `postEvent` to send an event to Pushwoosh:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"InAppFacade.postEvent(this, “eventName”, new HashMap<String, Object>());\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nIn order to add details about the event you should use attributes describing it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HashMap<String, Object> attributes = new HashMap<String, Object>();\\nattributes.put(\\\"AttributeString\\\", \\\"someString\\\");\\nattributes.put(\\\"AttributeInt\\\", 42);\\n\\nArrayList<Integer> arrayAttribute = new ArrayList<Integer>();\\narrayAttribute.add(1);\\narrayAttribute.add(2);\\narrayAttribute.add(3);\\nattributes.put(\\\"AttributeList\\\", arrayAttribute);\\n\\nattributes.put(\\\"AttributeBool\\\", Boolean.TRUE);\\nattributes.put(\\\"AttributeNull\\\", null);\\nattributes.put(\\\"AttributeDate\\\", new Date());\\n\\nInAppFacade.postEvent(this, “eventName”, attributes);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n## In-App Messages\n\nYou can also send events from In-App Javascript: [http://docs.pushwoosh.com/docs/in-app-messages#in-app-javascript](http://docs.pushwoosh.com/docs/in-app-messages#in-app-javascript)","excerpt":"","slug":"events","type":"basic","title":"Events"}
[block:callout] { "type": "info", "body": "Please [contact us](https://pushwoosh.com/contact-us) if you would like to try out this functionality in your apps.", "title": "Events functionality is currently in beta" } [/block] [block:api-header] { "type": "basic", "title": "Overview" } [/block] Events are intended to record various actions a user performs in the application. Unlike Tags that are used to store flat data (such as country, device model or installation data), event data is stored historically and can be treated as a history of user behaviour rather than a set of information about the device. All the contextual information about the event can be passed as a set of attributes and its values. Once properly collected, this data can be used to: - trigger certain [In-App Messages](http://pushwoosh.readme.io/docs/in-app-messages) to be displayed; - build a segment of users who are eligible to receive an In-App; - get insights about user flow in the app, usage metrics, and other statistical data. [block:api-header] { "type": "basic", "title": "Prerequisites" } [/block] Event data is valuable only if it's submitted properly. Therefore, we strongly recommend to follow the simple guidelines below: - Try to name events as short as possible; - Name events after actions a user performs in the app - "LoggedIn", "SignedOut", "Subscribed", etc.; - Keep in mind that event names are case-sensitive; - Merge events that describe a single action into a single event. I.e., use "Subscribed" event with proper attribution rather than separate "SubscribedToSports", "SubscribedToPolitics", "SubscribedToTechnology" events. [block:api-header] { "type": "basic", "title": "Attributes" } [/block] All details describing an event are provided with its attributes. All events sent by your application must be created in Pushwoosh first with the set of attributes and their types, otherwise Pushwoosh will not recognise them. All attributes are key/value pairs and can be of 5 different types: integer, string, list, date and boolean. For example, you can send a **Login** event when a user logs in, and add details about the type of login credentials (through Facebook, Google+, Twitter or email), internet connection type (wifi, cellular, unknown), and whether it was successful or not (true or false values): [block:parameters] { "data": { "0-0": "type", "0-1": "string", "1-0": "connection", "2-0": "success", "1-1": "string", "2-1": "boolean", "h-2": "value", "h-0": "attribute", "h-1": "type", "0-2": "facebook, google, twitter, email", "1-2": "wifi, cellular, unknown", "2-2": "true, false" }, "cols": 3, "rows": 3 } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/Sn6RZ74GROOvqF837BXQ_Pushwoosh___Applications___Demo_application___Events.png", "Pushwoosh___Applications___Demo_application___Events.png", "584", "652", "#25981f", "" ] } ] } [/block] This event will be recorded in Pushwoosh with attribute values and a timestamp, so later it can be used to build a segment of users who are eligible of receiving a certain In-App Message. [block:api-header] { "type": "basic", "title": "SDK" } [/block] ## iOS When an interesting event occurs in your iOS application, use the following instructions to send this event to Pushwoosh. Call the `postEvent` to send an event to Pushwoosh: [block:code] { "codes": [ { "code": "[[PushNotificationManager pushManager] postEvent:@“Login” withAttributes:@{}];", "language": "objectivec" } ] } [/block] In order to add details about the event you should use attributes describing it as follows: [block:code] { "codes": [ { "code": "NSDictionary *attributes = @{ @\"AttributeString\" : @\"someString\",\n\t\t\t\t\t\t\t\t @\"AttributeInt\" : @(42),\n\t\t\t\t\t\t\t\t @\"AttributeList\" : @[ @(123), @(456), @\"someString\" ],\n\t\t\t\t\t\t\t\t @\"AttributeBool\" : @YES,\n\t\t\t\t\t\t\t\t @\"AttributeDate\" : [NSDate date] };\n\n[[PushNotificationManager pushManager] postEvent:@“eventName” withAttributes:attributes];", "language": "objectivec" } ] } [/block] ## Android When an interesting event occurs in your Android application, use the following instructions to send this event to Pushwoosh. Call the `postEvent` to send an event to Pushwoosh: [block:code] { "codes": [ { "code": "InAppFacade.postEvent(this, “eventName”, new HashMap<String, Object>());", "language": "java" } ] } [/block] In order to add details about the event you should use attributes describing it: [block:code] { "codes": [ { "code": "HashMap<String, Object> attributes = new HashMap<String, Object>();\nattributes.put(\"AttributeString\", \"someString\");\nattributes.put(\"AttributeInt\", 42);\n\nArrayList<Integer> arrayAttribute = new ArrayList<Integer>();\narrayAttribute.add(1);\narrayAttribute.add(2);\narrayAttribute.add(3);\nattributes.put(\"AttributeList\", arrayAttribute);\n\nattributes.put(\"AttributeBool\", Boolean.TRUE);\nattributes.put(\"AttributeNull\", null);\nattributes.put(\"AttributeDate\", new Date());\n\nInAppFacade.postEvent(this, “eventName”, attributes);", "language": "java" } ] } [/block] ## In-App Messages You can also send events from In-App Javascript: [http://docs.pushwoosh.com/docs/in-app-messages#in-app-javascript](http://docs.pushwoosh.com/docs/in-app-messages#in-app-javascript)