if your levels are linear, you can just add a var 'level' starting at 1 and add 1 to it when you finish a level.
then save it to webstorage - add key="level" value=level.
if not i recommend you add a dictionary instead of pre-adding all the levels as vars (may be a lot of them) and push a key to it every time you finish a level - add key="level"&level (value doesn't matter, if you want to keep an extra state of the level you can write it in the value, i usually write down another json in the value with all my data).
then save this dictionary to json to webstorage.