If you're looking to figure out where the user is coming from then you would use the document.referrer
You can also mark users by cookies and see what links they've clicked and how they interacted with your site.
You can also mark users by cookies and see what links they've clicked and how they interacted with your site.