My goal: send information to Google Analytics (GA) regarding which page a user tried to reach when he/she lands on my 404 error page.
Currently, I am already sending events to GA when someone lands on my 404 page. But it would be helpful to add the complete URL the user tried to reach to the payload. Currently, the wixLocation.url variable always return “error404” on the 404 page, even though on my browser URL bar I have a different URL .
Example of current behavior:
-
User tries to reach mywebsite.com/page-that-doesnt-exist
-
Since this page doesn’t exist, the person is redirected to my 404 page
-
On the 404 page, the browser url bar still shows mywebsite.com/page-that-doesnt-exist , but the wixLocation.url returns “error404”.