On my website, I track when users click on a search result that brings them to a details page for an item. I then save what search query they used before they clicked.My current solution is this:Each link in search results is in the form /goto/<item_id>/?search_id=.../goto/<item_id>/ saves that a user used a given search id to get to a given item, and then returns a 302 redirect to /details/<item_id>//details/<item_id>/ displays the details page and does not do any tracking.For the users, everything works fine, but when I check Google search results for my page, the direct links to the details page URLs say /goto/<item_id>/?search_id=... with some old search_id, instead of /details/<item_id>/.I feel like I'm missing an obvious solution :) The only thing I came up with so far is using /details/<item_id>/ links in HTML and using JavaScript to replace them all with /goto/<item_id>/search_id=..., but that seems like an overkill.Any better ideas?
How to track click sources in a Google-compatible way?
seo;redirects;tracking