Google Search History Automatic Save JavaScript

JavaScript to Automatically Save Google Search History

I wrote software/extension to automatically save Google search keyword history to local storage, so I'll share a JavaScript script that can be used as a tampermonkey userscript. This script is written on the premise of the tampermonkey userscript feature that it runs every time the site is updated (= every time you access it).

Shou Arisaka
1 min read
Oct 29, 2025

I wrote software/extension to automatically save Google search keyword history to local storage, so Iโ€™ll share a JavaScript script that can be used as a tampermonkey userscript.

Image

I wrote it. Local storage is convenient. I recently discovered something called indexd DB and Iโ€™m interested in that too.

// ==UserScript==
// @name         store google search queries
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       tmp
// @match        https://www.google.co.jp/search?*
// @grant        none
// ==/UserScript==

if (localStorage.getItem('_storeQueries') == null) {
    localStorage.setItem('_storeQueries' , '') ;
}

localStorage.setItem('_storeQueries', localStorage.getItem('_storeQueries') + '"' + document.querySelector('#lst-ib').value + '"' + ',' + '"' + new Date().toISOString() + '"' + "\n" ) ;

This script is written on the premise of the tampermonkey userscript feature that it runs every time the site is updated (= every time you access it).

To check local storage, open the developer tools with the F12 key and view Application > localStorage > _storeQueries.

Share this article

Shou Arisaka Oct 29, 2025

๐Ÿ”— Copy Links