How to prevent this thing from being Cached or to be in Cookie
-
Hello,
There seems to be some sort of issue while using the LS Cache Plugin. We are using it in optimal settings (as suggested by Hosting provider, which is running on LS Servers)
I used a code snippet to show the Total number of Views (text of “views” changed to “Likes” in snippet) on each product page (in child theme’s functions.php file)
I found that the code is working correctly. That is the Page Views or Likes updates or increases on every Page Refresh while I’m being logged in (and for every logged-in user)
However, when I tried to visit the page as a guest user or visitor, it shows the Total Views for that currently moment, and only once.
Upon further Refresh of the same page (just like we are doing with as an Admin), the Views or Likes are NOT increasing or changing (means, not updating the way they were doing, for a logged-in user)Reason – As why the View Counter is updating for Logged-in User-
For that, we explored further and found that, we have Set the Settings of Cache > Cache tab > Cache Logged-In users to OFF
Due to this, it is correctly working for Admin (or any logged-in user). That is logical.
Means, that it is NOT getting cached for logged – In user.And hence, it might not be getting updated for a Guest User or visitor.
So, just wanted to know, how can we EXCLUDE just that thing (Total View Counts), from being Cached for Guests or Visitors. (Logged-out users)
In order to have it work properly and shows correct updated results of Total View CountsOne of such product page for your reference is below
https://www.vasangini.com/product/pink-tapestries-trident-mandala-bohemian-tapestry-queen-bedspread-free-ship-us/(PS: This can be checked on any other product too)
You can see the number of LOVES (below Add to Cart button), with a heart icon.
This is what we are referring to. You can try to replicate at your end by following below approach-
1. Once you open the page. Keep note of the number that is displayed to you, for the first time. Then Hit refresh or refresh the page (either desktop or mobile).
You will find the number will remain the same and will NOT increase or change.
PS: Try to check results by refreshing the page 5-10 times or more2. Then try to replicate the same as a logged-in user.
And then Hit the Refresh or refresh the page multiple times.
You will find that the counter will increase with every page refresh.3. Now that it has been confirmed (or will get confirmed), can you please suggest the Rule or Class to add in the Exclude section or some other way. In order to resolve this.
Please suggest some details. Also, in which Exclude section, I have to add that specific rule or Class or code.
And if it requires some other way, then please do suggest that.Kindly suggest and resolve
PS: If you require the Code Snippet, the please suggest where shall I post that securely or privately.
Regards
The page I need help with: [log in to see the link]
- The topic ‘How to prevent this thing from being Cached or to be in Cookie’ is closed to new replies.