Blast Analytics and Marketing

Analytics Blog

Supporting Leaders to EVOLVE
Category: Digital Analytics

How to Use the Universal Analytics Measurement Protocol to Integrate with SmartThings

September 13, 2013

Here at Blast, we’re always fiddling around with the newest gadgets.

When the boss showed up with a box of gizmos called SmartThings a few weeks back and starting talking about offline tracking data from intelligent monitors in Google Analytics, it peaked our interest to say the least!

What are SmartThings?

SmartThings help you remotely control and monitor almost any device in your home or office.

With SmartThings, you can control almost any device – your lights, thermostat, appliances, door locks, cameras, and etc.

It’s really easy to setup. Just connect a SmartThing controller to whatever you want to control and then sync it up with the SmartThing Wi-Fi hub.

And of course, there’s an app for that.

Monitoring Employee Movements at Blast

As our boss was unboxing the SmartThings, he said:

I know! Let’s monitor people’s movements in the office and then create reports using the new Universal Analytics Measurement Protocol…you know…just for fun”

Don’t get me wrong, our boss is the greatest guy in the world. But I think he has an ulterior motive!

Our prized Google neon lamp

In the end, we decided to monitor and/or control the following movements:

  • The front and back door opens and closes
  • Hallway traffic volume
  • Turning on our Google Analytics Partner neon light (no practical significance, just cool)

Putting Out the Tracking Toys

Let’s take a quick look at the pieces/parts we played with:

  • One central hub (connects into a router with a simple network cable and USB plug for power)
  • Two door monitors (each with a front and back part so that they know when they separate)
  • One motion sensor
  • Two key fob thingies that serve as presence detectors (are you here or not?)
  • One 110 volt outlet controller

Within 15 minutes we had the hub setup, one door monitor up, the motion detector in the hallway, and our Google Analytics partner neon lamp hooked up to the outlet controller. We logged into our SmartThings account using the iPhone app and immediately saw it detecting devices in use!

Here’s the actual analytics offline tracking code we developed on the SmartThings portal to get it to work.

So far, so good. Now on to the Google Universal Analytics Measurement Protocol.

What is the Universal Analytics Measurement Protocol?

Google’s Universal Analytics is the latest big reboot of the venerable Google Analytics tool.

One of the most exciting features of Universal Analytics is the new Measurement Protocol. Still in public beta, the Measurement Protocol allows developers to make HTTP requests to send ‘offline’ interaction data directly to Google Analytics servers. This allows businesses to track behavior of their customers from a wide variety of different non-web data sources.

Here are some links for more info:

Universal Analytics Detected the SmartThings Data

The first thing was to verify that Universal Analytics was actually tracking our devices. We launched the Real-Time Events (beta) reports and immediately saw activity. We saw that the devices were functioning as hoped and we starting to see a stream of physical event data being recorded.

Universal Analytics Event Report for Real-time offline event tracking

Using the Data to Prove (or Disprove) a Theory

For our first experiment, I hypothesized that our office hallway traffic would be less on Fridays. Makes sense, right? More people work from home, people taking 3-day weekends, people leaving early, and etc.

So was I right? Let’s look at the data.

Universal Analytics Event Report for offline motion tracking

Wrong! Turns out, Friday’s were really no different than other days.

The good news was there were no workers or burglars that we detected over the weekends. We’ll let this play out a few more weeks just to see if the pattern remains consistent.

Other Ideas for Universal Analytics Measurement Protocol Experiments

Quick brainstorming sessions amongst the analysts came up with some other offline tracking ideas for our office, as well as a few “blue-sky” concepts worthy of exploration.

Length of Bathroom Visit

Putting a motion detector inside the men’s bathroom in order to detect a bathroom “visit” from entry through exit seems interesting…sort of. The session would include the following offline tracking events that can all be tracked using SmartThings sensors.

  1. a door opening
  2. a door closing
  3. a door locking
  4. turning on an occupied light
  5. secondary motion (use your imagination)
  6. a door unlocking
  7. turning off an occupied light
  8. a door closing

We all agreed that at some point there might be recording errors introduced if the door opening got extended or if the motion detector didn’t reset soon enough to detect the exit event.

And while intriguing, we refused to put an open/close detector on the toilet lid to see how many times the seat was left up. Maybe the girls would be interested in that one!

Retail In-Store Tracking Scenarios

Obviously, the potential for retail in-store offline tracking applications is almost endless:

  • Monitor store entries to get an idea of how many store visitors you get per day and compare to that daily sales.
  • Monitor store net entries and exits to get an idea of customer volume trends during the day to better schedule staff times.
  • Monitor and measure which doors people use to enter and exit the store and at what points over time.
  • A motion detector at the back door gives you information about unexpected visitors or inventory loading events.

Office Tracking Scenarios

  • Setup a custom SMS alert when the server room goes above 70 degrees with a remote temperature sensor.
  • Setup an email alert to the supplier when the water cooler is empty.
  • Monitor entries and exits to the office and automatically set the alarm when the last person leaves.
  • A key fob attached to a laptop gives you patterns of use.


The integration of SmartThings with Universal Analytics is really a marriage made in analytics heaven. The possibilities seem to be countless… or when using the Measurement Protocol, at least countable!

One note about the Measurement Protocol: it was extremely easy to setup. I didn’t even have to worry about sessions or cookies. All it took was a one-line call per event, and BAM!, the interaction was recorded. I can envision the day when more and more network connected devices will be sending off notifications to Google Universal Analytics for monitoring, providing the every-day analyst new data from all types of physical sources.

Have your experimented with measuring real-world offline data using the Measurement Protocol? Let us know in the comments!

In the meantime, I’m going to start monitoring that toilet seat.

Paul Lear
About the Author

Paul is a Senior Analytics Consultant and Data Scientist at Blast. He has spent 20+ years venturing into the depths of software development, designing and implementing analytic solutions to automate business processes within all sizes of financial services institutions. Paul's experience spans software development, Business Intelligence design, eCommerce, database design, predictive modeling, and adaptive decision systems.

Connect with Paul on LinkedIn. Paul Lear has written on the Blast Digital Customer Experience and Analytics Blog.

We’re here to help with tips and insights on the following topics:

Data Management Digital Analytics Digital Experience Digital Transformation Marketing Activation User Privacy
HIPAA and Analytics White Paper CTA

Featured White Paper

Healthcare Analytics and HIPAA: Ways to Minimize Risk and Ensure Compliance

The rise in digital data and analytics adds complexity and risk for healthcare organizations. Those that don’t comply with data privacy requirements, including Health Insurance Portability and Accountability Act (HIPAA), could face heavy fines, civil action lawsuits, and even criminal charges. Not to mention loss of patient trust.

Download the White Paper

Ready To Do More With Your Data?

If you have questions or you’re ready to discuss how Blast can help you EVOLVE your organization, talk to an Analytics Consultant today.

Call 1 (888) 252-7866 or contact us below.