[Userscript] Wanikani Heatmap

You’ll need a script manager extension for your browser such as Tampermonkey. Install that first. Then you will need to install WaniKani Open Framework script (I was surprised to see the dependency not mentioned in the main post. You might want to amend that Kumirei). Installing scripts is as simple as clicking the provided installation link. Then come back here and install Heatmap using the installation link.

1 Like

Noted – have managed to browse through… and successfully installed the script.
It is quite a helpful script.

1 Like

If you don’t already have it then you will be prompted to install it afterwards

Sure but, pretty much every userscript I’ve seen that has open framework as a dependency mentions so in its main post and links to the installation instructions so someone finding the script can take care of that without ending up installing the script and being prompted and then redirected, need to install it, then need to refresh the page they were on… it’s a user experience that should be a fallback and mitigated up front if possible by just informing them before installation it will be needed.

2 Likes

Hey, so I decided to start up reviews again after a while

My heatmap seems to not have all my review history anymore?

Lesson history still seems fine tho

2 Likes

Several months ago, the GetAllReviews API endpoint was taken down due to performance concerns. This means that if your review cache was ever cleared, or you have just installed Heatmap, it cannot grab your reviews from the past and will only keep track of them going forward (and only on the device you do the reviews, see quote below).

4 Likes

Sad times

4 Likes

Oh I see, that’s unfortunate :c

Thanks!

1 Like

Hello, for some reason I lost 4 years of heatmap when I logged in today, didn’t do anything in particular. Just noticed everything was just gone. none of my reviews from 2019 till September 30 2023 are showing

However the lesson tab still shows my past lessons. Did Chrome erase it all? is this restorable or am I screwed?

edit: Just saw the message above mine with pretty much the same issue, I’m still using the same device I think the only thing I did was update chrome to latest version, oh man If I lost it all I’m gonna be depressed

1 Like

I don’t know much about Chrome, but a browser update really shouldn’t clear a website’s storage like that. You can check your IndexedDB by opening the devtools (F12) while on wanikani and navigating to the Application tab (at least that’s what Google is telling me, it’s the Storage tab in Firefox), looking under the Storage section at the left and expanding the entries under IndexedDB until you find wkof.file_cache > files and see what you have for the review_cache key-value pair. But I think all you’ll find is that it contains only the small amount of reviews you see in the Heatmap.

It’s curious though that you say this happened when you logged in today but Heatmap still shows reviews for the previous two days. If your IndexedDB did get cleared, it doesn’t make sense that these two days wouldn’t also get erased. Perhaps Kumirei can shed some light on why this is the case, as I am unsure.

Do you do regular backups of your system? In particular your AppData folder if you’re on Windows? This is where browsers will store indexedDB data, so if you have a backup, you could try “restoring” it by copying the backed up files to the current folders and seeing if Chrome “repairs” it that way. (This is actually why I mentioned creating something that would regularly back up my wanikani indexeddb several posts above; I have a ScheduledJob that runs every day, but this isn’t ideal. I’m going to have to write a Windows Service to have an autostartable background job that will copy the contents any time a change to the database is detected).

I am not aware of any reason why the DB would be cleared other than clearing the browser cache or IndexedDB getting corrupted (which I have only seen on Firefox). Regardless, unless you have a personal backup there is no way to restore the lost data. The data will be only be restored once WK reopens the API

Thanks for your message, this is what my review_cache looks like I think it’s probably what you said.

this probably happened 2 days ago actually thus why I had reviews, I was having the same issue other people were having where heatmap just disappeared from the wk page but I didn’t care much and just did a few reviews as normal, only today do I notice everything is gone,

I would assume a browser cache-clearing would be the cause but I didn’t manually do one, and I have very old files in my cache still so I don’t know, maybe updating chrome did clear files automatically or something, my cache folder looks very big I have no idea where to find the heatmap file to check if it’s still there

Yeah there’s really no way to tell what could have caused Chrome to clear your WaniKani site data. And unfortunately like Kumirei said, if you weren’t keeping a backup of the files there’s no way to recover the past reviews for the time being.

Yeah pretty much screwed then, time to delete this plugin now I guess I don’t see the point of it anymore.

1 Like

I changed browsers to Opera GX and for some reason, this userscript stopped working (as far as I know, only this one).
OperaGX flagged tampermonkey as malware and simply blocked it from being used, so I instead added Tampermonkey Beta since some users recommended. However after that the component for heatmap isn’t being rendered. Opening the console in the browser I can see the page still loads info about heatmat such as colour and position for years, months and days, but the element is not present. I also can see through the extension icon that heatmap is active on the page.

Anyone went through something similar, or is using Tampermonkey Beta on OperaGX without trouble, so I know not the browser neither the T. Beta are the problem? Thanks in advance. Suggestions on how to unblock OG tampermonkey are also appreciated since I couldn’t do the solutions I found.

1 Like

You might just need to do some reviews in that browser for it to show up. Note that reviews will not automatically transfer from your old browser to your new one

2 Likes

Oh you’re right, did some reviews and it appeared thankfully, thank you. It’s a shame that the progress is not transferred tho, but it’s definitely better than not having it at all. Is it only the reviews that don’t transfer? The lessons appear just fine. Also, is there a known way to manually transfer the data?

1 Like

The lessons history is still available through the API, whereas the review history is no longer available (it used to be), so that is why lessons transfer but reviews do not.

To transfer reviews you can follow these steps

  1. Find the browser console (F12 → Console)
  2. Export review cache to a string by inputting JSON.stringify(await review_cache.get_reviews())
    a. Copy the string, including enclosing quotes (just hit copy)
  3. Transfer to new device by your preferred method
  4. Insert into review cache review_cache.insert(JSON.parse(<string>))
2 Likes

Hey:)
I just had to reformat my pc and after I set up this plugin again my reviews are reset, my lessons are still up to date though.
I saw that in the settings you can reload review data but I dont have that button where it is supposed to be in your provided screenshots.
If you have any idea what I could try to do it would be very much appreciated!
ありがとう

2 Likes

Please read any of the conversations above you. Unfortunately, there is no way to get your historical reviews back as long as the API endpoint needed to do so is down, you would have had to make a backup of wherever your browser stores indexedDB on your system before reformatting.

2 Likes