How to track back 'first page seen URL' of any visitor coming on to your website

I need to track the ‘first page’ which is seen by a visitor once they had submitted any form on my website.

For eg: A visitor landed on ‘Home’ page from his organic search via google and then navigated through the website and submitted the form on the ‘Contact Us’ page. How can I get the first page seen URL?

As of now, with the form, I’m able to get the ‘current’ page URL which is in above example is ‘Contact Us’ page and a referrer page to it.

Please help?

You asked this in another topic and I replied. Please avoid cross posting as it just makes a mess.

This is weird! Can you just direct me to the place where you have posted a solution for this? Would be of great help, thanks!

You would need to create the code as I provided an outline only.