Linking in-store and online commerce using Sitecore Commerce and valtech_vantage Part 2
januari 12, 2018
In the previous post we provided an overview of how Valtech Vantage and Sitecore Commerce can be combined to create a unified view of the customer both in-store and online. In this post we explore some of the technical details to illustrate how Sitecore xDB can be used to track offline interactions.
What valtech_vantage provides
As a user interacts with valtech_vantage the master beacon in the facility orchestrates the individual devices. When an event is triggered in-store, Vantage can be configured to send an event message to an endpoint. Events include:
- User has registered
- Known device has connected to network (entered store)
- Known device has disconnected from network (left store)
- Unknown device detected (entered store)
- Unknown device signal lost (left store)
- Known device entered defined area (entered a particular “department”)
- Known device left defined area (left a particular “department”)
- Unknown device entered defined area (entered a particular “department”)
- Unknown device left defined area (left a particular “department”)
The result is the endpoint being sent a JSON message. For a non-registration event, that JSON payload will look something like:
Sitecore processing of a valtech_vantage event
We made the choice to leverage the Sitecore.Services.Infrastructure.Web.Http.ServicesApiController class to build the endpoint in Sitecore. We did so as the infrastructure already exists for robust security policies and there is no need to register customer routes.
The code structure is pretty straight forward:
The result of the code above is an end point at http://<site>/sitecore/api/ssc/valtech-vantage-sitecoreconnector-services/remoteevent/0/RecordEvent that will respond to POST messages. Note the URL is driven by the namespace, class and methods names.
Inside our endpoint we can then implement the logic to store events in xDB.
Storing offline interactions in xDB
Before we get into code, there are a few decisions you should make. In the valtech_vantage connector we have chosen to allow a very robust configuration of the module that allows different organizations to adjust how they track the data. Below we discuss the key decisions and our default setup.
- Channels. Sitecore allows marketers to define any number of channels. There is a default Offline channel called “Enter Store” which is configured at /sitecore/system/Marketing Control Panel/Taxonomies/Channel/Offline/Store/Enter store. We default to this, but depending on the volume of stores and regional structures you may wish to setup multiple channels to make segmentation easier. For example, setting up a channel for each sales region.
- Venues denote particular locations. Defined in the Marketing Control Panel at /sitecore/system/Marketing Control Panel/Taxonomies/Venue/ you will likely want a venue per store.
- Outcome Groups and Outcomes are the offline equivalent of Goals. Defining Outcomes that you want to register as part of a valtech_vantage event will allow you see these events in the xProfile timeline and to associate a monetary value if applicable.
Sitecore code for offline interactions
The key classes for offline interactions are found in Sitecore.Analytics.Tracking.External. There are two primary considerations:
- Interaction registration (behinds the scenes this maps to a pageview-like structure)
- Outcome registration
We’ve simplified the code of the connector to illustrate, but the following is a complete example of registering an interaction and outcome. We have an object “event”, that is a model the represents the data sent from valtech_vantage. Sitecore has published similar snippets of code, but there are a few small omissions. Namely be sure to set the date values or it messes up the timeline view in xAnalytics.
While the code above should be enough to get you started, there are a few things to keep in mind. When dealing with event-driven systems like valtech_vantage in real time, it can be helpful to create local queues to store the events and then process them as appropriate. If you consider the enter store event followed by numerous triangulation events, such as entering a department, it will often be more appropriate to wait for the leave store event and then replay the events in xDB.
We hope these series of posts helps to illustrate how valtech_vantage and Sitecore can be used to create a unified view of the customer. If you extend these data feeds into xDB to include point of sale systems, CRM and other customer sources you can build a powerful view of the customer.
Read part 1 of this series of articles here.