URL parameters expiration

When I use Location.to() to send the user to a specific page with defined parameters (/somepage?someparameter=somevalue), the query part of the url persists - when the user changes pages or reloads the page, the “?someparameter=somevalue” is always present in the URL.
How can I have this part expire or delete it manually after getting the value? The page needs to be able to distinguish between a case when someone got to it directly and a case when someone gets there through a specific code (when the parameter is appended). So, once the value was used, it should be reset or deleted.
I know I can use wix-storage instead of url parameters, but if possible, I prefer not to go down that route.

Add your links manually with wixLocation.to for each link that way you remove the query when changing pages.

However I’m wondering if there’s a way to set the query parameter while the user is on the side without reloading the page. Like the wixCode API reference page
@yisrael-wix

Exactly - I want to set the query parameter without reloading.

Many have run into this problem. The short answer is : you cannot reset the query-string. Once you set :

somepage?var1=val1&var2=val2

the var1=val1&var2=val2 part gets attached to every link in your site, even in menus, buttons, images ,etc.

It´s a nuisance and leads to unforseen behaviour. The way I “handled” this shortcoming was to reset the values to whatever (“nulll”) and check on “null” every time, like so:

var1=null&var2=null

It´s not pretty, I know, and kindoif non-standard behaviour.

Thanks.
It seems really stupid that this is the case, doesn’t it? I mean - is there any sense behind it?