{"_id":"59e70ba0e027ae002e7d2f3b","category":{"_id":"59e70b9ee027ae002e7d2ed7","version":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-06-01T08:45:54.712Z","from_sync":false,"order":4,"slug":"geofencing-triggers","title":"Geofencing Triggers"},"parentDoc":null,"project":"5496d393f52a630b00519cdd","user":"5496d353f52a630b00519cdc","version":{"_id":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":2,"createdAt":"2017-10-18T08:06:54.462Z","releaseDate":"2017-10-18T08:06:54.462Z","categories":["59e70b9ee027ae002e7d2ed3","59e70b9ee027ae002e7d2ed4","59e70b9ee027ae002e7d2ed5","59e70b9ee027ae002e7d2ed6","59e70b9ee027ae002e7d2ed7","59e70b9ee027ae002e7d2ed8","59e70b9ee027ae002e7d2ed9","59e70b9ee027ae002e7d2eda","59e70b9ee027ae002e7d2edb","59e70b9ee027ae002e7d2edc","59e70b9ee027ae002e7d2edd","59e70b9ee027ae002e7d2ede","59e70b9ee027ae002e7d2edf","5b8661ccdd19310003a3fa0b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.10","version":"2.0.10"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-27T12:52:22.505Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Rules\"\n}\n[/block]\nRules generate triggers once all their criteria are matched. \nRules are created using Objects, Events, Time Delay, and Targe parameters (see below tables).\nEach rule has a unique ID, and a custom tag that describes it.\n\n##Rule Object\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Supported Values\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Example\",\n    \"0-0\": \"geofence\",\n    \"0-1\": \"Made of coordinates and a radius. To use geofences, see the following documents:\\n  * [Geofence/create](doc:create) \\n  * [Geofence/delete](doc:delete) \\n  * [Geofence](doc:get-all-geofences)\\n\\n**Geofence based triggers are activated within 3 minutes from user arrival to a place.**\",\n    \"0-2\": \"JSON array\",\n    \"1-0\": \"place_type\",\n    \"1-1\": \"May be any place type, venue category or subcategory. For example: home, work, hospital, gym, fast food restaurant, etc.\\n\\n**Place-type based triggers are activated within 15 minutes from user arrival to a place.**\",\n    \"3-0\": \"scenario\\n*(coming soon)*\",\n    \"3-1\": \"Placer supports various scenarios, for example: user is traveling to Italy, the user has arrived to Wallmart superstore, etc.\",\n    \"2-0\": \"venue_id or chain_id\",\n    \"2-1\": \"Define any venue or chain Id that is supported by Placer to generate trigger upon user arrival.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n##Rule Events\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Supported Values\",\n    \"0-0\": \"arrival\",\n    \"1-0\": \"departure\\n*(coming soon)*\",\n    \"h-1\": \"Description\",\n    \"0-1\": \"The trigger will occur upon arrival to the rule object\",\n    \"1-1\": \"The trigger will occur upon departure from the rule object\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n##Rule Time Delay\nA delay parameter measured in minutes, which is used to delay the trigger. For example, this can allow you to get notified 30 minutes after the user has arrived home.\n\n##Rule Audience Target\nSet the relevant target users, devices or segments for the rule.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Supported Values\",\n    \"0-0\": \"user_id\",\n    \"h-1\": \"Description\",\n    \"0-1\": \"A list of App User IDs.\",\n    \"1-0\": \"device_id\",\n    \"1-1\": \"A list of Placer Device IDs.\",\n    \"2-0\": \"segments\",\n    \"2-1\": \"Any combination of attributes from [Placer Insights](doc:user-insights)\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n##Rule Notification Target\nOnce rules criteria were matched, the target destination can be one of the following:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Supported Values\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"sdk\",\n    \"1-0\": \"server\",\n    \"2-0\": \"all\",\n    \"0-1\": \"A delegated SDK function will be called within the device (client). See \\\"Customization Features\\\" section in [iOS](doc:ios) or [Android](doc:android) for implementation instructions.\",\n    \"1-1\": \"A server callback URL. To define the server callback function go to [Triggers/set_callback/](doc:triggersset_callback)\",\n    \"2-1\": \"An SDK delegated function and server callback will be called.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n## Creating Rules\nCurrently, rules can only be created by your Placer account manager. Please let us know which rules you are interested in by contacting info:::at:::placer.io.\nHowever, you may create and delete geofence objects using the server API, as documented in this guide.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Trigger Response\"\n}\n[/block]\nThe trigger response structure is returned upon rule criteria match. The response is sent to the server and/or the SDK delegated function.\n\nPlease see [Trigger Response Structure](doc:triggers) for further info.\n\nSee [Triggers/set_callback/](doc:triggersset_callback) in order to define a server callback URL and understand how to authenticate triggers origin.\nSee \"Geofencing\" section in [iOS](doc:ios) or [Android](doc:android) for implementation instructions.","excerpt":"Geofencing allows you to define rules that will call a server callback or an SDK function once the criteria is matched.\n\nUse cases:\n- **Classic Geofence**: user arrival to a specific location with predefined coordinates and radius.\n- **Place Type**: user's arrival to a certain type of place, such as: Home, Work, Airport, Hotel, Asian Restaurant, etc.\n- **Scenarios**: custom events, such as: \"the user is traveling abroad\", \"30 minutes before the user goes out to lunch\", \"the user has arrived to a walmart superstore\" etc.","slug":"getting-started-1","type":"basic","title":"Getting Started"}

Getting Started

Geofencing allows you to define rules that will call a server callback or an SDK function once the criteria is matched. Use cases: - **Classic Geofence**: user arrival to a specific location with predefined coordinates and radius. - **Place Type**: user's arrival to a certain type of place, such as: Home, Work, Airport, Hotel, Asian Restaurant, etc. - **Scenarios**: custom events, such as: "the user is traveling abroad", "30 minutes before the user goes out to lunch", "the user has arrived to a walmart superstore" etc.

[block:api-header] { "type": "basic", "title": "Rules" } [/block] Rules generate triggers once all their criteria are matched. Rules are created using Objects, Events, Time Delay, and Targe parameters (see below tables). Each rule has a unique ID, and a custom tag that describes it. ##Rule Object [block:parameters] { "data": { "h-0": "Supported Values", "h-1": "Description", "h-2": "Type", "h-3": "Example", "0-0": "geofence", "0-1": "Made of coordinates and a radius. To use geofences, see the following documents:\n * [Geofence/create](doc:create) \n * [Geofence/delete](doc:delete) \n * [Geofence](doc:get-all-geofences)\n\n**Geofence based triggers are activated within 3 minutes from user arrival to a place.**", "0-2": "JSON array", "1-0": "place_type", "1-1": "May be any place type, venue category or subcategory. For example: home, work, hospital, gym, fast food restaurant, etc.\n\n**Place-type based triggers are activated within 15 minutes from user arrival to a place.**", "3-0": "scenario\n*(coming soon)*", "3-1": "Placer supports various scenarios, for example: user is traveling to Italy, the user has arrived to Wallmart superstore, etc.", "2-0": "venue_id or chain_id", "2-1": "Define any venue or chain Id that is supported by Placer to generate trigger upon user arrival." }, "cols": 2, "rows": 4 } [/block] ##Rule Events [block:parameters] { "data": { "h-0": "Supported Values", "0-0": "arrival", "1-0": "departure\n*(coming soon)*", "h-1": "Description", "0-1": "The trigger will occur upon arrival to the rule object", "1-1": "The trigger will occur upon departure from the rule object" }, "cols": 2, "rows": 2 } [/block] ##Rule Time Delay A delay parameter measured in minutes, which is used to delay the trigger. For example, this can allow you to get notified 30 minutes after the user has arrived home. ##Rule Audience Target Set the relevant target users, devices or segments for the rule. [block:parameters] { "data": { "h-0": "Supported Values", "0-0": "user_id", "h-1": "Description", "0-1": "A list of App User IDs.", "1-0": "device_id", "1-1": "A list of Placer Device IDs.", "2-0": "segments", "2-1": "Any combination of attributes from [Placer Insights](doc:user-insights)" }, "cols": 2, "rows": 3 } [/block] ##Rule Notification Target Once rules criteria were matched, the target destination can be one of the following: [block:parameters] { "data": { "h-0": "Supported Values", "h-1": "Description", "0-0": "sdk", "1-0": "server", "2-0": "all", "0-1": "A delegated SDK function will be called within the device (client). See \"Customization Features\" section in [iOS](doc:ios) or [Android](doc:android) for implementation instructions.", "1-1": "A server callback URL. To define the server callback function go to [Triggers/set_callback/](doc:triggersset_callback)", "2-1": "An SDK delegated function and server callback will be called." }, "cols": 2, "rows": 3 } [/block] ## Creating Rules Currently, rules can only be created by your Placer account manager. Please let us know which rules you are interested in by contacting info@placer.io. However, you may create and delete geofence objects using the server API, as documented in this guide. [block:api-header] { "type": "basic", "title": "Trigger Response" } [/block] The trigger response structure is returned upon rule criteria match. The response is sent to the server and/or the SDK delegated function. Please see [Trigger Response Structure](doc:triggers) for further info. See [Triggers/set_callback/](doc:triggersset_callback) in order to define a server callback URL and understand how to authenticate triggers origin. See "Geofencing" section in [iOS](doc:ios) or [Android](doc:android) for implementation instructions.