Ambient Web Metrics

A few years ago, when I was tinkering with my Arduino board, and was a little tighter with PHP than I am now, I pulled together a little experiment in ambient web metrics. It was pretty basic and a little kludgy, but simultaneously kinda neat. I’ve been thinking about that hack lately, and how I’d approach it now, if I had to do it all over again.

What It Was

On the Arduino side, I had three LEDs hooked up to the digital ports, and the Arduino plugged into the USB port on my desktop machine. The Arduino listened to that USB port for an incoming single byte. Depending on which byte it received, it lit one of the three LEDs.

The desktop machine had a domain assigned to it, and had three PHP files sitting in my ~/Sites directory. Each of those files was fundamentally the same, except for the filename and a single byte in them. Each file was coded such that when it was executed (via http request), it would send the appropriate byte to the appropriate USB device.

For the websites I wanted to track, I did an include(); that pulled the appropriate file from my desktop’s webserver. Those includes were done in the header of the page layout.

I’m sure if you get the jist of it. Page load on remote server triggers PHP on local desktop box, which then triggers behavior in the Arduino (“blinkenlights”). It was a truly simple hack, but it was fun.

What I’d Do Now

Since all my stuff uses Google Analytics, I’d use the API to pull data. I’d also do something other than just raw blinks based on page loads. Something like Phillips Hue or a SmartThings setup would be useful for the “display” portion of things. I’d probably ditch the one-pageload-to-one-blink setup for something a little more subtle — perhaps a weighted system that changed colors and intensity based on which site had the most traffic (color) and overall volume (intensity).


Just something I’ve chewed on in the back of my head for a few hours today. Will I actually attack this? Eh, maybe. Right now, I’ve got that Arduino doing duty as an intervalometer for my DSLR camera, and I’ve been noodling around with some ideas for other Arduino apps. We’ll see where I go with all of this.

At some point, I’ll dig up all my original code and publish it on here. If I do anything else with the concept, I’ll document it.