What is the Measurement Protocol?
The developer guide for the measurement protocol succinctly offers this description;
The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This allows developers to measure how users interact with their business from almost any environment
What does this mean in the real world?
It means those with a curious nature can hook up offline activity and send that interaction data to Google Analytics to slice & dice. It also means it opens the door to spammers and unscrupulous marketers to send referral and any other kind of interaction data to your Google Analytics account without having to interact with your connected properties.
Let’s not talk about the second use too much, that’s a different conversation. Let’s instead concentrate on how we can use the Measurement Protocol more for it’s intended use.
For me, back in October 2015 I had an
epif epiph I realised I could use the Measurement Protocol if i could get my hands on an Integrated Developer Environment (IDE). All I would then need to do is build the Hit I wanted to send from that environment. Now armed with how I thought it would all work, I needed to find that product with an IDE, which is where SmartThings comes in.
What is SmartThings?
I would nick a paragraph explaining what SmartThings is from their site but it uses words and paragraphs that I cannot figure out the meaning of, salesy type stuff. Instead let me try and offer my meaning;
SmartThings is an Internet of Things connected hub with interactive devices you can control and monitor via a smart app.
The starter kit comes with;
- presence sensor
- power outlet
- motion sensor
- multi sensor
You can buy more of these separately, the starter kit costs around Â£200, it’s also available via some Google Shopping merchants for around Â£9k. Personally i went with the Â£200 option.
The setup is very straightforward, plug the hub into your router via the supplied Ethernet cable and start connecting your devices however you want to use them. I set up my motion sensor on the stairs, multi sensor on the front door, presence sensor on my car keys and power outlet on the lamp in my living room.
The SmartThings IDE allows you to control your locations, hubs and devices as well as access the developer tools and documentation. This was a huge leap in my quest to understanding how often my stairs were being used. Once registered for the IDE and after adding your new “location”, you can add your new “SmartApp”.
Here is the code for you to shamelessly borrow for your own use. Modify it, play around with it, connect it to different devices. Have fun with it.
There are also a tonne of inbuilt templates that you can use and adapt that have been developed by others, accessible via the “From Template” link. I especially like the “Ridiculously Automated Garage Door”, but also the “Elder Care” routine (something I also envisaged but never built).
Alexa & SmartThings
The possibilities are endless with connected devices. I’ve bought an additional 3 Power Outlets and use them interchangeably throughout the year, renaming them in the app & controlling them via the Alexa App.
Some of my common routines;
- “Alexa, Turn on the Christmas lights” (controls all inside & outside on/off)
- “Alexa, Game time” (Turns on heating, Fruit machine, Playstation etc)
While these are dependent on just Power Outlets & Amazon Alexa (SmartThings Smart Home enabled Skill) there are endless possibilities to use your connected home. And measure it.
My next step is to create another Amazon Alexa Skill, but this time, an interactive version of Link BuilderÂ where I can send the interaction data back to Google Analytics as an event. That way, I truly can understand that it is 99% people swearing at Alexa.
SmartThings + IFTTT
Just as a brief experiment I thought I would hook SmartThings up to Twitter via IFTTT for no other reason other than to see if it worked. Now every time there was motion detected on the stairs it would tweet that activity. I can think of other similar uses and again not a huge leap of faith to envisage creating an automated blog of activity.
Also I could easily imagine the use of the Multi Sensors in a retail environment to control staffing levels based on Google Analytics historical data. A connected Multi Sensor triggering an event every time a store door opens/closes. Or even rear of store deliveries. That time data would improve staffing levels at a much cheaper rate than current solutions on the market.
The caveat to that though is not everyone is Google Analytics friendly so that data and consumption would also have to be simplified, I wrote a post a few years back on A Guide to Custom Reporting Using the Google Analytics Spreadsheet Add-on, that would be the perfect solution.
So what does the motion on my stairs data look like?
Apart from the time I forgot to change the battery in the sensor (and some weird Skynet thing where it sourced its own power) it looks like this;
What does all this have to do with Search?
“It’s the year of mobile”, “It’s the year of voice search”
While there are efforts out there to understand interaction between devices using User-ID, that can surely only tell part of the story.
With that better connected data we will have a better picture of how our products and services truly are being used. And improve them further.
Have a similar integration? I would love to know about it!