Bug 982663: collect and report app usage data

This patch does not have tests yet, and is still missing a couple of features, but it has working code and is ready for feedback and preliminary review.
What's the reason to use origin to identify an app?
Do we want to collect data of web pages also in the future?
Origin is not a good way to distinguish app, honestly.