I need to hook into whenever a user moves from one page to another. I need to know where they are coming from and where they are going. My scenario is that anytime that a user heads to a certain section of the site (search) it modifies the path to add a variable. But I only want to to do so when they are coming from outside that section of the site.
I have been looking at hook_url_inbound_alter() which gets me in when a user is about to move to another page, and gives me where they are going, but not where they came from. Any suggestions?
HTTP_REFERER
. Note that this cannot be trusted all time as this can be modified, if this doesnt affect you you can use this to get last visited pagehook_url_inbound_alter
. This hook allows you modify how links that link within your website are displayed. It does not tell you a user clicked on that link.