Project Description

Log real life events in Google Analytics

arduino_prism
This project is about google analytics which is great tool to monitor what happens on my website or my mobile applications.
Real life tracking is everywhere : GPS tracker for jogging,how you sleep…..

Souce code

There is some HttpClient out there for Arduino.
You can download it from Github : https://gist.github.com/damienalexandre/6080444

This couple of lines did the trick for the request part:

String eventData = "v=1&tid=UA-0000000-0&cid=1337&t=event&ec=irl&ea=visitor&el=IRL Visit&ev=1";
client.println("POST /collect HTTP/1.1");
client.println("Host: www.google-analytics.com");
client.print("Content-Length: ");
client.println(eventData.length());
client.println("Content-Type:application/x-www-form-urlencoded");
client.println();
client.println(eventData);

Schemetic

Log real life events in Google Analytics_1
If the sensor and the HTTP request worked, we have added two LED(red and green).
It’s not shown on the schema, but obviously we use an Ethernet Shield (the one from Arduino).

Result

Log real life events in Google Analytics_2
Here we go: every foot crossing our carpet is now logged (even the NSA is aware of it) and displayed in our Analytics dashboard:

For more information, please refer to the following link.
https://jolicode.com/blog/log-real-life-events-in-google-analytics