The Internet of Things (IoT) has gotten more buzz than the latest Marvel movie! In this session w’ll learn how to connect offline data from IoT devices and use it to bring the omni-channel view of your customer much closer to 360 degrees.

Before going in detail, i think we should go through the basic terminologies used in this Article.

Internet of Things (IoT): The IoT is a network of physical objects enabled to collect and exchange data. The Internet of Things revolves around increased machine-to-machine communication; it’s built on cloud computing and networks of data-gathering sensors; it’s mobile, virtual, and instantaneous connection; and they say it’s going to make everything in our lives from streetlights to seaports “smart.”

Customer Profile: Customer profiling is a way to create a portrait of your customers to help you make design decisions concerning your service. Your customers are broken down into groups of customers sharing similar goals and characteristics and each group is given a representative with a photo, a name, and a description. A small group of customer profiles or ‘personas’ are then used to make key design decisions with, e.g. “which of these features will help Mary achieve her goals most easily?”

Experience Profile: Sitecore 8 introduces Experience Profile, and this the great start of knowing your customer. It lets you monitor the behavior of contacts that have interacted with your company or with your website. You can identify current as well as future customers from their very first point of contact, even if they have not provided a name. The Experience Profile enables you and your sales teams to monitor the key areas of customer experience and interaction, such as visits, campaigns, goals, profiles, automation, outcomes, and keywords. For example, for each contact, you can see at a glance which events and goals they have triggered as well as how many engagement value points they have accumulated on your website

The biggest drawback of experience profile is that, it captures only online interaction/data. What if we go beyond web direction interactions and want to track offline activities? To answer this question, we would design a solution with a real life scenario.

 

The Scenario

Wearable devices are currently at the heart of just about every discussion related to the Internet of Things. The requirement for self-health monitoring and preventive medicine is increasing due to the projected dramatic increase in the number of elderly people until 2020. Developed technologies are truly able to reduce the overall costs for prevention and monitoring. This is possible by constantly monitoring health indicators in various areas, and in particular, wearable devices are considered to carry this task out.

In our example, we will try to simulate one of that wearable device like Smart Watch for health monitoring. The smart watch will track all your sport’s activities. Based on collected data from the IoT device, we can perform analytics on it and determine necessary actions to be taken. In our case, we would personalize the content for the current user, whenever he visits the application.

We would consider below sports activities for our solution.

Technical Flow

The IoT device (simulator) capture these activity data and send to Azure Notification Hub. Notification Hub than pushes that data to various devices or listeners. Based on data received from Notification Hub, Sitecore would determine the customer profile and assign a profile card to the current user. Now based on that profile card, you can personalize your content on your site.

 

Pieces of the Solution

  1. IoT Device: To capture activity data and send to the notification hub.
  2. Azure IoT Hub: Secure bidirectional communications from/to devices and cloud.
  3. Sitecore/xDB: To personalize your site content based on profile card.

  

IoT Device

Every IoT device capture relevant data from the device and store it in digital format or transfer that data over a network. To simulate this, we can create a small application, where we can manually set that data and send it over the network to Azure IoT Hub.

This application will collect the data from the screen and send it to the IoT hub in json format (depicted in left panel). There will be one listener that will always listen for the data on IoT Hub and whenever the data is available, Notification Hub pushes this notification to all listeners. The listener (depicted in right panel below) collects that data and send it to Sitecore EntityService. Now EntityService will store that device data into xDB.

And one console application that will register the device to Azure IoT hub.

 

Azure IoT Hub

Azure IoT Hub is a fully managed service that enables reliable and secure bidirectional communications between millions of IoT devices and a solution back end. The Azure IoT Hub supports both HTTP and AMQP out of the box. With these two technologies, any IP-capable field devices are able to communicate with the hub (if they don’t, a field gateway can also be used to facilitate communication).

Register IoT Device with Hub

Once we configured IoT Hub in Azure, now we need to register IoT Device to this newly created IoT Hub with the help of below details (That can be collected during IoT Hub deployment seen below).

HostName = SitecoreIoTHub.azure-devices.net;

SharedAccessKeyName = iothubowner;

SharedAccessKey = M4SvC7cjiBRIhg529MCVe2bUWY+SsrHIglVu+/5Ajuo=

To register IoT device simulator to Hub, we will create a console application.

 

Sitecore/xDB

On the Sitecore side, we will be customizing and working on below points.

  1. Create Profiles & Pattern Cards
  2. Extend the xDB Contact
  3. Create a new EntityService

Create Profiles & Pattern Cards

Here we create three Profiles Keys in Sport Profile and 5 pattern cards based on these profile keys. Whenever a user visits the application, one pattern card would be applied to the current user based on their interactions. These pattern cards will be used for content personalization with the help of rule engine.

 

Extending the xDB Contact

In this section, we would create a Helix based Feature called IoT feature and extend the xDB contact by creating model with fields for the device data, Facet, a collection of device data and configuration file for additional details.

 

Create a new EntityService

EntityService would be used to send device data (received from Azure Notification Hub) to Sitecore. It allows us to interact with content items or custom business objects of the Sitecore. In our solution, There would be 3 parts of EntitySerivce i.e. the Model, the Repository and the Controller. As we would be working with xDB and actually using the Tracker, we have to make EntityService session aware, which is by default not session aware.

 

Personalizing Page

If we go with the example user mentioned in figure above with (local1@test.com and swimming data) we would get this below personalized content for this user.

and if we go with a user (local3@test.com) who participated in all three activities i.e. in Cycling, Running and swimming as below screen.

We will get the different personalized content based on pattern card mentioned previously called Triathlete.

This is how, we can utilize xDB, Internet of Things (IoTs) and Azure IoT Hub and Notification Hub with Sitecore and Sitecore EntityService to achieve our goal.

 

What’s Next

xConnect is a promising new framework, will be introduced in Sitecore 8.3, that should give us an (easy) API to work with analytics data. Sitecore will be using the framework itself in several modules. We will be able to use it to integrate all kinds of external data into xDB (write) or get all sorts of combined data out of xDB (read) to be used in code or external tools (e.g.Power BI).

I am eagerly waiting for Sitecore 8.3 for xProfile & xConnect and wanted to checkout these cool features and many more.

Thanks for your time reading this article and hope this will help you to understand this integration well.

 

References

My sincere thanks to Jason Wilkerson and the SUGCON Europe team for this wonderful example to make us understand this integration in detail.