Mobile app version of vmapp.org
Login or Join
Twilah146

: How to track click sources in a Google-compatible way? 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

@Twilah146

Posted in: #Redirects #Seo #Tracking

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Twilah146

2 Comments

Sorted by latest first Latest Oldest Best

 

@Hamaas447

I finally found the answer. Google caches:


the URL you redirect FROM if you use a 302 (temporary) redirect
the URL you redirect TO if you use a 301 (permanent) redirect


So I only had to change 302 to 301 to correct my site's Google search results.

10% popularity Vote Up Vote Down


 

@Samaraweera270

seo redirects trackingession variable with the search query?

Then, once on your item detail page, you write in your database the item id and the query.

This way, you don't need the javascript magic and the redirect page.

Hope this helps

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme