Convoluted Time Series IoT Data Capture & View Inspiration
Don't you hate having to sign up for online services? There's always that tinge of fear that you might forget to cancel before the end of the free trial period, or that you might forget about it and see a bill for $2.99 a year later which has been going on month after month.
If only there was some super robust, completely, permanent way to store complex, time-series data points...but absolutely free to the point where one is never even asked for a credit card. Well it turns out there is, and it's called...wait for it...Google Analytics!
"But Patrick, Google Analytics is not an IoT platform!" -Person reading this post, probably.
You're absolutely right, it's not at all! That's the beauty of this setup...we're repurposing Google Analytics to measure website hits in a new way.
What Convoluted Time Series IoT Data Capture & View Does
Part of what is interesting about Internet of Things devices and paradigms is the ability to capture, transmit, store and analyze data over time, meaning points of data attached to timestamps. This ability to slice data either based upon the data type or the time at which it was captured is part of the magic of what makes systems "real-time" or "responsive" or, dare I say it - artificially intelligent in some way. You've got to start out knowing precisely when the data was captured, and then use that in your analysis.
How "Convoluted Time Series IoT Data Capture & View" Is Built
- An IoT device captures data through its sensor, or gets an interrupt through a button push.
- That data is translated into a variable, which gets added as a string on the end of an HTTP call.
- The device makes an HTTP call to a static website with Google Tag Manager installed.
- Google Tag Manager calls Google Analytics and through a special setup transfers our original data variable to Google Analytics as something called a, "custom dimension."
- That custom dimension is stored persistently within Google Analytics FOREVER (as far as anyone can tell, Google Analytics has stored data since its inception).
- We can always go back and call the data through an API, or report and filter a particular dataset based upon some special tricks in Google Analytics, such as assigning a, "userID" to a particular IoT device, and filtering based upon user.
This is not a panacea. Yeah, we're storing data, but in a weird way. There's always a possibility that Google Analytics can revoke access to a particular property based upon their perceived violation of their terms of service. Security is another challenge - whose to say that no one else can guess our code and start visiting our static website and feeding it a bunch of crap information, potentially spoofing devices? HTTP by its nature is an open protocol, so arguably this is kind of a dumb way of doing things. But whatever...this is for fun, and we could hypothetically close of the website only to known IP addresses. Of course that creates a bunch of other work...but again, this is not intended for commercialization, but rather an exercise in learning about some tools.
Accomplishments to be Proud Of
According to the standards of what constitutes a hackathon, this is definitely within the, "hacking," side of the spectrum.
Google Tag Manager and Google Analytics are pretty valuable skills in it of themselves, if you are interested in working in that area. This is a way to learn more about Google Analytics than 99% of people out there, and to understand more about how it works from a developer perspective.
What's next for Convoluted Time Series IoT Data Capture & View
After the success of this project, we can open source what we have built, publish it on Github, write a blog article, and try to get a bunch of hits on Hacker News. I see this as a chance to evangelist and interesting direction or emphasis of where device-driven data should be and a way to reach a bit further in the future of device-driven development, since we are dealing with time-series data, which is trickier to deal with, but yet is an important component of the mechanisms of and workings of what a lot of people and companies talk about as being, "the future of IoT."