Browser Domains Key

The activity page (for a single day) displays the Top Browser Domains. However the web buckets don’t have a browser domain key, instead they have a url key. This makes it impossible to use the web query interface to list the all time top browser domains.

So, my feature request is to add a computed browser domain key called domain

The following code should then return the top browser domains

ff_events = query_bucket(find_bucket('aw-watcher-web-firefox'));
events = merge_events_by_keys(ff_events, ['domain']);
events = sort_by_duration(events);
RETURN = events;

The query language is still being developed and is currently poorly documented, I’m sorry for that.
But if you look at the queries in the webui there is an method called “split_url_events” which adds more keys to all events which have a “url” field.
Here’s an example:

events = query_bucket("aw-watcher-web-firefox");
events = split_url_events(events);
events = merge_events_by_keys(events, ["domain"]);
events = sort_by_duration(events);
RETURN = events;

This will return this

{
  [
    {
      "data": {
        "audible": false,
        "domain": "forum.activitywatch.net",
        "incognito": false,
        "params": "",
        "path": "/t/browser-domains-key/318",
        "protocol": "https",
        "tabCount": 17,
        "title": "Browser Domains Key - Features - ActivityWatch Forum",
        "url": "https://forum.activitywatch.net/t/browser-domains-key/318"
      },
      "duration": 7.524,
      "id": null,
      "timestamp": "2019-06-12T18:03:59.044Z"
    }
  ]
}

Also, in the latest git version of the webui we have added a “Summary” page which shows top application usage so that will be in the next release. We are hoping to add browser usage to that soon as well.

1 Like