4 Ways To Send a Customer Back to Last Viewed Product
The reader wanted to know, technically, how you can determine the last page the customer was viewing. I ran this question by Ivan Jensen, one of Elastic Path's senior product developers and he came back with a number of ways you can accomplish this:
1. Referrer header
The most obvious would be using the referrer header, which will tell you which page directed you to the new page. There are some issues with this, however:
1. The browser may chose not to send the referrer. It is optional and there are even some browser plug-ins that prevent the sending of referrer (for privacy reasons).
2. Depending on your URLs, the referrer may not give enough information. This is particularly true where the information is contained in the POST data, rather than the URL.
2. Embed the location in forms
You could embed the last page visited in the forms that will be submitted back to the server. You can just inspect that form parameter in the standard way to know where the request has come from.
(If you're an email subscriber and you have images turned off by default, the code is contained in an image to display properly in the post.)
3. Use the item that was added to the cart
If you know that the “green bathrobe” was just added to cart then you know you could just return to that product, or one of it’s categories, or related categories.
4. Track last page visited in the session
On each request simply store the page in the session. Use that to drive your continue shopping feature. Be sure to only track your catalog pages – not your checkout pages.
I hope this helps you with optimizing your own online store. Big thanks to Ivan for providing these tips, you can read more of his thoughts on Agile on his blog.