Using Google Analytics To Track WeMo Switch + Motion

Have you ever thought about tracking something OTHER than your website using Google Analytics?

No? Well this video may get your imagination going.

I’ve hooked up a Belkin WeMo Switch and Motion to a pre-release version of Google’s Universal Analytics. Every time I turn the switch on or off, or activate the sensor, the data is logged in GA.

Belkin WeMo Switch + Motion

Belkin WeMo Switch + Motion

I use pageviews in this demo so you can see the data coming in in real-time, but I’m also storing data in a custom dimension that identifies which switch has been triggered and firing an event that captures the state of the switch.

In my reports I can see:

  • Number of times switch was used per day.
  • Which switch was being used.

Uses & Benefits

You may think there is no practical application for this. And you’re right, simply tracking a light turning on and off is not that beneficial.

But this is simply a proof of concept. The device could be anything.

It could be your in store EPOS system to track offline transactions. It could be multiple pressure sensors beneath the carpet of your store monitoring footfall around your shop and which sections are most popular.

Technical Details

For the most geeky amoungst you.

  • The two WeMo devices sit on my wireless network.
  • I wrote a python script (that utilises the Ouimeaux library with a few of my own modifications) to poll each device in turn and detect change of a change of state.
  • I also implement a wrapper around the Universal Analytics Measurement Protocol in python, allowing me to send data to Google without the need for a browser (that’s the purpose of the Measurement Protocol!).
  • The data I send to Google each time a sensor is triggered consists of a pageview (for real-time demoing) and an event with a custom dimension called ‘Sensor’ which contains the name of the sensor that has been triggered.
  • A custom report in Google Analytics shows the number of events that have happened for each sensor.
WeMo Sensor Report in Google Universal Analytics

WeMo sensor report in Google Universal Analytics

Universal Analytics Custom Report

Custom ‘Sensor’ Dimension within a Google Analytics Custom Report


My thanks goes to:

is a Senior Consultant for Elisa DBI (now part of Havas Media).

10 comments en "Using Google Analytics To Track WeMo Switch + Motion"

Leave a comment

E-mail (not displayed)
Web page