The Physical Web

"Walk up and use anything" is the promise of the Physical Web. It is an open source project started by Google that allows you to access to online resource via physical objects.

The concept

The physical web is based on hardware beacons that broadcast data using Bluetooth Low Energy (BLE) without the need to pair the device. In this case, the data is an URL. For now, it requires you to install an app on your mobile device. This app will scan in the background the surroundings for beacons and will inform you whenever you come across one. You'll then be presented with a list of URL, one per beacon. If the project is successful, this feature may be built-in your mobile OS in the future, thus removing the need for an external app.

There are already some beacons available. I bought a physical web pack from Blesh, but there are more providers. You can also turn your laptop or other devices into beacons using the projects listed here. There's even an implementation for Node.js.

The Physical Web beacons by Blesh

These projects allow you do to both reading and advertising. The app required to read physical web beacons is available on Android and iOS.

mDNS support

Advertising URL on a local network is also supported thanks to mDNS. It works essentially by using a _http._tcp service with an optional TXT record for the path. As noted on the website, the advantage over BLE is that reading is limited to the devices connected to the local network and won't leak to unauthorised people. It also enables broadcasting longer URLs.

Criticism

This project is really interesting because it helps discovering content useful locally using the P2P web. Unfortunately I wish the concept had been taken further and instead of advertising URL that requires an Internet connection to be visited, it could have advertised content stored locally, on a embedded server. You can always advertise URL from a local network using mDNS, but how to make sure the visitors are connected to the correct local network if you use BLE? I understand it is probably in Google's own interest to promote Internet and force users to remain connected at all time. They're not making money on local content completely disconnected from the Internet.

Also it looks like the main use case is to advertise products and services. I strongly think the web and the Internet of things shouldn't be about consumption and profit only. The P2P Web should reinforce local communities and make people to help each other. It should enable you to connect with local people (It sounds cheesy, I know...). Anyway, the web being what you make of it, I still think the physical web is an interesting project.

Next step

I've started building an app to implement the Physical Web on Firefox OS. It will allow you to read and act as a physical web beacons. At the moment BLE is not implemented on B2G, but it's coming to v3, later this year. So in the meantime, I'm relaying on mDNS.

I've set up one of the physical web beacons to advertise the URL of this blog. I'm carrying this beacon with me most of the time. So if you come across it in the streets of London, you'll know I'm not far away!

Comments

Privacy and Google Analytics

The problem

After reading a post comparing analytics solutions, I realised most people ignore that Google Analytics can be fine tuned to comply with stricter privacy policies. In this post, I'll share the solutions I implemented to keep using Google Analytics without compromising my visitors (a.k.a. yourself) privacy.

Please note that the code only relates to the latest analytics.js API. Look for support pages for older versions of Google Analytics.

The solutions

Disable data sharing

By default, the data collected from Google Analytics are shared across several services like:

Though this data sharing should be harmless most of the time, you can disable it in your account settings. You can read more about it on the data sharing settings support page.

Anonymise IP address

Google Analytics has a built-in feature to anonymise IP address (see this help page for details). When enabled, the last few digits of the visitor's IP address are set to 0 (IPv6 is supported). In theory it is not possible for Google to map an anonymised IP address to a specific user. Also, according to their documentation, the complete IP address is never logged.

However, I read the relevant document carefully and noticed it's not very clear to me if Google logs the IP address when the analytics.js file is requested from their server. If you're a bit paranoid, you may decide not to trust Google here. In such case, you'll want to proxy it on your own domain and refresh it as often as possible. I haven't tried myself, but if you're doing that, let me know as I'd love to read more.

Obviously, the down side of this setting is you get a less accurate geographic report as it is based on the IP address. But who needs a granularity to the level of a city?

Implement an opt-out mechanism

You can easily give your users the ability to deactivate tracking. Just create a setting in your app that sets the following property to true:

window['ga-disable-UA-XXXXXX-Y'] = true; // Replace UA-XXXXXX-Y by your Google Analytics ID

You can persist this setting in your user account, so that her preference is is kept whatever the device she's using to access your website. But for performance reason, I recommend not to load Google Analytics at all when your user has opted out. You can read more about user opt-out in the help pages.

Don't use cookies

Though not directly related to privacy, not setting cookies is likely to increase your visitors confidence while removing the need to display a message related to the EU cookie directive.

Instead of cookies, use local storage for storing the visitor identifier used by Google Analytics, the so called clientId parameter. This technique has a beneficial aspect on performance as well. The browser won't send all the cookie detail with every request made to an asset located in the same domain as the page.

Here is the code used in this blog:

ga('create', 'UA-XXXXXX-Y', { // Use your own ID!
  'storage': 'none',
  'clientId': localStorage.getItem('gaClientId')
});
ga(function(tracker) {
  localStorage.setItem('gaClientId', tracker.get('clientId'));
});
ga('send','pageview')

Comply with Do Not Track

The DNT is not only exposed to the client as a HTTP header but also as a property on the navigator object: navigator.doNotTrack. This returns:

You can wrap the code responsible for loading Google Analytics in a if statement like I do in this blog (examine the source for yourself if you don't believe me!):

if (navigator.doNotTrack !== '1') {
  // Load Google Analytics and track user.
}

Force SSL

This blog is hosted on Github pages. Unfortunately, https is not (yet?) supported. The least I could do was to force the analytics.js file and the beacon to be respectively received and sent encrypted. More info about the forceSSL setting is available.

The challenge

Some of the solutions presented here depend on your level of trust. I decided to trust Google even if I can never have the certitude that they really do what they say they do. So after all, your trust level may be different and you can decide whether to apply the solutions mentioned above or turn to other analytics services, like Piwik.

Also, I would have loved to see Google making some of these options easier. For example, support of DNT could have been made an option in the account settings. Also, we can't create a custom IP masking function to push anonymisation even further.

Google Analytics offer some very basic privacy aware options, but they should offer more!

Comments