Where does GM_setValue store data? Where does GM_setValue store data? google-chrome google-chrome

Where does GM_setValue store data?


In Tampermonkey, GM_setValue() data is stored in a LevelDB database that can be found in the User Data Directory tree.

Once in Chrome's "User Data Directory" (EG: C:\Users\USER_JOE\AppData\Local\Google\Chrome\User Data\Default\),

navigate to the Local Extension Settings\dhdgffkkebhmkfjojejmpbldmpobfkfo folder.

(gcalenpjmijncebpfijmoaglllgpjagf for the Tampermonkey Beta.)

There you will find a LevelDB database, usually named CURRENT. You can manipulate it with tools like LevelDB JSON, but external support for LevelDB currently appears to be spotty and I did not find any working tools for Windows yet (might have to compile your own).

You can also use the Chrome Storage Area Explorer extension to explore the data.

As of Tampermonkey 4.3.6, you can see an individual script's data with the Storage tab in the built-in script editor: (if the 'Storage' tab is not visible, edit Tampermonkey Settings > General Config mode > Advanced)

Script Storage editor




OLD, Pre November-ish 2015:

  • Before, about November 2015, data was stored in a Web SQL database in databases\chrome-extension_dhdgffkkebhmkfjojejmpbldmpobfkfo_0.

Once you have navigated to the correct folder, you will typically see two files. On my machine, they are currently just named 4 and 6. These are both SQLite files (the backend for Chrome's Web SQL implementation) and can be inspected with a SQLite viewer/utility.

The (normally) larger file, 6 on my machine, is a somewhat disturbing list of 94-thousand userscripts! I'm not sure what purpose it serves, but haven't investigated it much.

The smaller file (initially, at least), 4 on my machine, is where all the information about/for your userscripts is kept. This includes any data set by GM_setValue().


For example, if I install and run this userscript:

// ==UserScript==// @name     _GM_setValue demo// @match    https://stackoverflow.com/questions/*// @grant    GM_setValue// ==/UserScript==GM_setValue ('foo', 'bar');

And then I inspect the `config` table in file `4`, I will see four entries like this: [![DB entries for sample script][8]][8]
The one you want is the `@st` row. Notice how it has the `GM_setValue` data encoded? :

DB entry, money shot