{"__v":5,"_id":"565b955b922c9a0d00d1f124","category":{"project":"55e67aaa9cc7c62b00c4a1ea","version":"55e67aab9cc7c62b00c4a1ed","_id":"589b8e1fdbb7cd190026732c","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-02-08T21:31:11.878Z","from_sync":false,"order":6,"slug":"advanced-techniques","title":"Advanced Techniques"},"parentDoc":null,"project":"55e67aaa9cc7c62b00c4a1ea","user":"55d29988486de50d00327118","version":{"__v":10,"_id":"55e67aab9cc7c62b00c4a1ed","project":"55e67aaa9cc7c62b00c4a1ea","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z","categories":["55e67aac9cc7c62b00c4a1ee","55e67b5556007d23005fee7d","55e67b5dde6fef23009480ca","55e680efde6fef23009480db","55e6829485a9741900314e99","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","589b8e1fdbb7cd190026732c","58b8ca5e3265d70f001788d4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":["565c739ed18ae50d0071833c"],"next":{"pages":[],"description":""},"createdAt":"2015-11-30T00:16:27.211Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"## What are iBeacons\niBeacons are small signal generators that advertise their location via Bluetooth. An Android or iOS Device may look for these signals and then receive updates about proximity to the beacon.\n\nAs a developer, you can collect this data, process it and then send it to Carnival for creating audiences, and triggering automated messages.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"iBeacon is beacon technology that is owned by Apple. The name \\\"iBeacon\\\" has become synonymous with beacon technology in general, as it is widely used.\",\n  \"title\": \"iBeacon vs Beacon\"\n}\n[/block]\n## Data from iBeacons\nThe Beacon protocol has several key attributes, including:\n\n * UUID: A unique, hexadecimal identifier for the device \n * Major: A non-negative integer \n * Minor: A non-negative integer \n * RSSI: A decibel value of signal strength from the beacon\n \n\nThis data is then translated into something more usable by either iOS or a 3rd Party Beacon SDK such as [Estimote](http://estimote.com/), [Gimbal](https://www.gimbal.com/#beaconGiveawayPanel) or [Kontakt](http://kontakt.io/). On iOS, you can use Core Location OR a 3rd party SDK from your beacon provider. On Android, it's easiest to use a 3rd party library. \n\n## Understanding Major and Minor\nRegular beacon devices have three attributes – a UUID, Major and Minor. Apple recommends [using one UUID for all your beacons](https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf), and differentiating locations hierarchically with major and minor versions. \n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ygvWI8glQ8eHOPtIAyhi_Screen-Shot-2015-07-27-at-6.49.10-PM.png\",\n        \"Screen-Shot-2015-07-27-at-6.49.10-PM.png\",\n        \"1013\",\n        \"338\",\n        \"#dcdcdc\",\n        \"\"\n      ],\n      \"caption\": \"A sample from \\\"Getting started with iBeacons\\\" from Apple\"\n    }\n  ]\n}\n[/block]\nGetting the actual data via your provider's SDK is dependent on the SDK implementation, so refer to their documentation for instructions. \n\nOn iOS Devices, you can use the CoreLocation API, which you can read about on [Ray Wenderlich](http://www.raywenderlich.com/101891/ibeacons-tutorial-ios-swift). \n\n## Getting Data to Carnival\nNow that you've got the data, you can finally pass it to Carnival. We recommend doing this via [User Attributes](http://docs.carnival.io/docs/collecting-user-data#user-attributes) and [Custom Events](http://docs.carnival.io/docs/collecting-user-data#custom-events).\n\nSome useful User Attributes you might want to set may be: \n\n * Last seen (Date)\n * Distance (Float)\n * Major (Integer)\n * Minor (Integer)\n * UUID (String)\n\nSome Custom Events you might want to log may be:\n\n * iBeacon seen\n * iBeacon **with this name** seen\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Working with User Attributes in the background\",\n  \"body\": \"On iOS, you'll be able to get location updates in the background. However, this code must be executed within a certain time limit and stay within a single thread. Therefore, it is advised you use the Synchronous versions of the API, which are indicated by their NSError parameter.\"\n}\n[/block]\n## Further Reading\n\nFor messaging best practices is developer tips, refer to these two iBeacon articles on the Carnival Insights blog: \n\n* [iBeacon Pro-Tips for Developers](http://insights.carnival.io/ibeacon-protips-for-developers/)\n* [Targeting Messages with iBeacons](http://insights.carnival.io/targeting-messages-with-ibeacons/)","excerpt":"How to integrate Carnival and iBeacons","slug":"ibeacons","type":"basic","title":"iBeacons"}

iBeacons

How to integrate Carnival and iBeacons

## What are iBeacons iBeacons are small signal generators that advertise their location via Bluetooth. An Android or iOS Device may look for these signals and then receive updates about proximity to the beacon. As a developer, you can collect this data, process it and then send it to Carnival for creating audiences, and triggering automated messages. [block:callout] { "type": "success", "body": "iBeacon is beacon technology that is owned by Apple. The name \"iBeacon\" has become synonymous with beacon technology in general, as it is widely used.", "title": "iBeacon vs Beacon" } [/block] ## Data from iBeacons The Beacon protocol has several key attributes, including: * UUID: A unique, hexadecimal identifier for the device * Major: A non-negative integer * Minor: A non-negative integer * RSSI: A decibel value of signal strength from the beacon This data is then translated into something more usable by either iOS or a 3rd Party Beacon SDK such as [Estimote](http://estimote.com/), [Gimbal](https://www.gimbal.com/#beaconGiveawayPanel) or [Kontakt](http://kontakt.io/). On iOS, you can use Core Location OR a 3rd party SDK from your beacon provider. On Android, it's easiest to use a 3rd party library. ## Understanding Major and Minor Regular beacon devices have three attributes – a UUID, Major and Minor. Apple recommends [using one UUID for all your beacons](https://developer.apple.com/ibeacon/Getting-Started-with-iBeacon.pdf), and differentiating locations hierarchically with major and minor versions. [block:image] { "images": [ { "image": [ "https://files.readme.io/ygvWI8glQ8eHOPtIAyhi_Screen-Shot-2015-07-27-at-6.49.10-PM.png", "Screen-Shot-2015-07-27-at-6.49.10-PM.png", "1013", "338", "#dcdcdc", "" ], "caption": "A sample from \"Getting started with iBeacons\" from Apple" } ] } [/block] Getting the actual data via your provider's SDK is dependent on the SDK implementation, so refer to their documentation for instructions. On iOS Devices, you can use the CoreLocation API, which you can read about on [Ray Wenderlich](http://www.raywenderlich.com/101891/ibeacons-tutorial-ios-swift). ## Getting Data to Carnival Now that you've got the data, you can finally pass it to Carnival. We recommend doing this via [User Attributes](http://docs.carnival.io/docs/collecting-user-data#user-attributes) and [Custom Events](http://docs.carnival.io/docs/collecting-user-data#custom-events). Some useful User Attributes you might want to set may be: * Last seen (Date) * Distance (Float) * Major (Integer) * Minor (Integer) * UUID (String) Some Custom Events you might want to log may be: * iBeacon seen * iBeacon **with this name** seen [block:callout] { "type": "warning", "title": "Working with User Attributes in the background", "body": "On iOS, you'll be able to get location updates in the background. However, this code must be executed within a certain time limit and stay within a single thread. Therefore, it is advised you use the Synchronous versions of the API, which are indicated by their NSError parameter." } [/block] ## Further Reading For messaging best practices is developer tips, refer to these two iBeacon articles on the Carnival Insights blog: * [iBeacon Pro-Tips for Developers](http://insights.carnival.io/ibeacon-protips-for-developers/) * [Targeting Messages with iBeacons](http://insights.carnival.io/targeting-messages-with-ibeacons/)