Count urls in chrome browser history that were visited via google search

Is it possible to use Chrome History API to count the number of URLs in the history that were visited using google search engine?

For each visited URL, Chrome History API provides a VisitItem object which can be used to access the visit id of the referrer (referringVisitId attribute).

If the URL (say is visited (clicked) from google search results, then the value of referringVisitId is always 0 when it should be the visit id of google search results URL. Why is the value of referringVisitId 0 in this case? What is the purpose of referringVisitId attribute?

How can one remove a selected range of history items where urls match a specific pattern in a chrome browser extension?

Chrome provides the chrome.history API to allow extension developers to manipulate the browsing history of a Chrome instance.

There are methods for deleting an individual URL from the history as well as for deleting a range of URLs based on date, but I’m not seeing a way to remove a URL pattern within a specified date range.

For example, one tends to accumulate a lot of history items related to one’s email client that are fairly useless after a short period of time. One might create a regex like so that would detect all instances of this URL in the history:


But one does not want to delete every instance – otherwise navigation through recently browsed items in one’s email client would become impossible, so it would be best to be able to filter by date range (e.g. > 5 days past)…but as far as I can tell, there is no way to accomplish this?

How to record users active time on chrome for each website?

My senior project is to build a google chrome extension to manage history and clean it. I want to know how I can get active time on each website, in a way that I can later on display it and use it to delete history and remove cache. Is there any specific API that I can use.
Any help is appreciated.