4Ps Marketing

Measuring Footfall With Google Analytics

If you’ve read any of my content before you’ll know I’m an enormous geek, and so I was incredibly excited when Google introduced the Measurement Protocol in their release of Universal Analytics. For those who aren’t aware, this lets developers send raw user interaction data straight to Google Analytics so is designed to enable measurement in new environments, including offline. Perfect for tracking in-store footfall!

The Challenge

One of our clients on the sports team challenged me to find a way to measure in-person visits to their bricks and mortar store. Naturally the Measurement Protocol sprang to mind, but while there are a lot of custom footfall tracking technologies available these tend to be quite costly, so we decided after a workshop to brainstorm some ideas that we would build a custom solution.

We settled on a PIR (passive infrared) sensor. These change voltage when they detect movement, so in theory if we set one up at the entrance of the store it would fire every time someone came in because it would detect the motion.

Solution & Installation

The Measurement Protocol allows any “hits” like this to be sent to Google Analytics from any internet-enabled device, but of course the PIR on its own isn’t connected. To get it online so data could be sent from it to GA, we used a Raspberry Pi. By connecting the PIR sensor to its GPIO (General Purpose Input / Output) header, we could then write some code that would send a “hit” to GA whenever movement was detected.

We used Python for this – a very powerful language, and already part of the stack provided with the Linux distribution which comes with a Raspberry Pi. I’ve documented the code fully on my own blog if you want to see it. Here’s the Raspberry Pi with the PIR sensor attached.

For installation in the client’s premises, the PIR sensor needed a clear view of the front door and the Raspberry Pi needed to be plugged in for power. Fortunately there was an in-store television with a USB port we could use to plug in, and as it was on the mezzanine above the main store entrance it gave the PIR a good view of the doors. Here’s the view it had, and the Raspberry Pi attached to the store TV.

The Results

Once we were online, data began flowing almost instantaneously into GA. I’m a big advocate of GA, so perhaps I’m biased, but I think this shows what a great tool it is as it lets you do this for free!

We created a very simple dashboard to show the number of in-store visits (recorded as pageviews). Unfortunately the Dashboard feature in GA is a bit limited – with things like Data Studio 360 and Analytics Canvas / Tableau it would be easy to mash up a nicer dashboard comparing visit performance by hour and day, but this is fine for a working proof of concept.

What We Learned, And Next Steps

Probably our biggest takeaway from this was to bring an independent power supply! As we were drawing power from the store TV it needed to be on all the time, but the store’s staff quite often forgot to turn it on when opening or turned it off partway through the day, which of course meant no data came through. We’re in the process of giving the Raspberry Pi its own (dedicated) power supply.

Google Analytics also allows us to define custom dimensions and metrics, so we are going to introduce a Store Visit metric and pass the date and time from the Raspberry Pi across to GA. In addition, because the store has two floors, we are also planning on introducing a second Raspberry Pi to the upper floor so we can pass Floor as another dimension and see what percentage of visitors to the store actually go upstairs. We may also introduce a calculated metric to half the number of visits, as it is of course possible for the PIR to detect people leaving as well as entering the store.

The next iteration, therefore, would be exciting but quite difficult; switching from the PIR to use a camera to detect individuals, possibly using Google’s Cloud Vision API. This would stop double counting and potentially (depending upon how complicated or simple we wanted to get) allow us to use the hash of an individual’s face somehow as a User or Client Id. This in turn would (on paper at least) lead to an understanding how many times the same person may visit a store.

I’d love to hear from anyone who can help or has any other cool ideas for in-store footfall measurement, so please reach out on Twitter or drop me an email.

4Ps isn’t just another SEO agency. To discuss how content, data and advertising are evolving together in order to keep pace with new developments in user interaction and technology, give us a call on +44 (0)207 607 5650 for a no-obligation coffee and chat about marketing and behaviour across all inbound channels.