I wanted to do some js analytics, so I would need to know how to get whatever the user entered in the address bar as a js variable so I can know what are the most common misspellings. That way I can make redirects for the most common misspellings to the correct adresses and reduce 404 page requests.
example of user input in browser:
https://stackoverflow.com/questions
.........................................
I have tried using
document.location
but that shows what page the user is on (i.e. 404 page address), not what they have typed