• Resolved andrew55

    (@andrew55)


    I’m new to LiteSpeed Cache. We use WooCommerce along with AffilateWP. AffiliateWP is very dependent upon accurate cookies:

    * affwp_ref – this cookie stores the affiliate’s unique ID
    * affwp_ref_visit_id – this cookie stores the visit ID (the visit ID increments by 1, each time any referral link is used until the cookie expires or is deleted).
    * affwp_campaign – this cookie will only be stored if an affiliate generates an affiliate referral URL with a campaign name from the Affiliate Area

    Do I need to add these cookies to “Cookies List” section in the LiteSpeed Cache plugin settings to prevent them from being cached? If so, would it be something like:

    affwp_ref
    affwp_ref_visit_id
    affwp_campaign

    I’m just not sure how the caching of cookies works yet in LiteSpeed Cache. Thanks for any suggestions.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support LiteSpeed Lisa

    (@lclarke)

    If you want to prevent the cookies from being cached, then, yes, you would add them to the Do Not Cache Cookies list. And you would do it one-per-line, just like you have listed there.

    Welcome to LiteSpeed Cache 🙂 Let us know if you run into any problems!

    Thread Starter andrew55

    (@andrew55)

    Is there a setting to disable caching of all cookies? Maybe I’m missing something, but I can’t imagine a circumstance where that would ever be needed/appropriate. Thanks for any clarification/suggestions.

    Thread Starter andrew55

    (@andrew55)

    Can someone tell me if cookies are cached for all users (similar to page cache) or are they cached for individual users (similar to browser cache). Been searching and can’t seem to find how cookies work with this plugin.

    Also, can anyone give an example of when caching cookies might be helpful, and maybe when it should be avoided?

    I’m just trying to understand so I know how to set things up.

    Thanks for any help.

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    Hi, @andrew55.

    Cookies and caching can be a little bit complicated, so I’m happy to try and explain it further.

    Can someone tell me if cookies are cached for all users (similar to page cache) or are they cached for individual users (similar to browser cache). Been searching and can’t seem to find how cookies work with this plugin.

    The two types of cache you are referring to are “Public” and “Private.” And just to clarify, it’s not the cookies themselves that are being cached or not cached. It’s the pages of the site that are being cached or not cached based on whether a user has those cookies stored. Cookies, generally, are ignored unless you specify otherwise.

    Cookies become important when they effect the user experience in some way. If a cookie must be set or read by WordPress, then it has to be excluded from cache.

    So, in the case of your affiliate cookies, if WP is reading those cookies at any time, then they need to be added to the Do Not Cache Cookie as previously advised.

    And here’s something else important: if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookie’s value.

    Also, can anyone give an example of when caching cookies might be helpful, and maybe when it should be avoided?

    This forum post is a good example of a situation where cookies are used to distinguish one type of visitor from another. The cookie is then used to determine which variation of a page in the public cache should be served to that visitor. (That’s called a “cache vary” and it’s very useful.)

    I hope this helps! Let me know if you need any further clarification. In the meantime, I’ll update our wiki with this information 🙂

    Thread Starter andrew55

    (@andrew55)

    Thank you very much for taking the time for a thorough explanation. This is so important, as we need our site to function properly.

    The cookies for our affiliate program merely identify what affiliate should get a commission if the user makes a purchase. They follow the user throughout the site, all the way to checkout.

    If this is so…

    It’s the pages of the site that are being cached or not cached based on whether a user has those cookies stored.

    …If I have the affiliate cookies listed in the “do not cache” area of the LiteSpeed plugin, when a user arrives on a page from an affiliate link, will this page not be cached for this user?

    It’s important to me to have “all” users hit cached pages so content (text, images, etc) will load faster, regardless of what cookies they have in their browser.

    I’m sorry to be a pain, but based on what you’ve clarified, I’m not understanding why affiliate cookies should be excluded with the cache settings. What would be the purpose?

    When you say this…

    If a cookie must be set or read by WordPress, then it has to be excluded from cache.

    …Do you mean that if there is an affiliate tracking cookie, this cookie needs to be excluded from the cache, and as a results of this, no cached pages will show for the user who has this cookie? Will this result in a text, images, etc loading slower?

    Also, when you say this…

    if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookie’s value.

    …are you saying I need to disable cache for these pages altogether? So, no text, images, ect can be cached for any users, if a cookie is set from this specific page?

    Thanks for any clarification for these questions.

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    …If I have the affiliate cookies listed in the “do not cache” area of the LiteSpeed plugin, when a user arrives on a page from an affiliate link, will this page not be cached for this user?

    It will not.

    I’m not understanding why affiliate cookies should be excluded with the cache settings. What would be the purpose?

    It all depends on how the cookie is processed. If WP needs to read or change the contents of the cookie, the page cannot be cached. A cached page is static. It doesn’t invoke PHP at all. But PHP needs to be used if the cookie is manipulated in any way.

    When you say this…

    If a cookie must be set or read by WordPress, then it has to be excluded from cache.

    …Do you mean that if there is an affiliate tracking cookie, this cookie needs to be excluded from the cache, and as a results of this, no cached pages will show for the user who has this cookie?

    Yes.

    Will this result in a text, images, etc loading slower?

    Yes and no. LSCache is for dynamic content (i.e. PHP). LSCache doesn’t cache static content like images in the first place, so they wouldn’t be affected by this.

    Also, when you say this…

    if the cookies are set on your site (i.e. they are not set somewhere before arriving at your site), then you will also have to exclude the page that sets the cookie’s value.

    …are you saying I need to disable cache for these pages altogether? So, no text, images, ect can be cached for any users, if a cookie is set from this specific page?

    Yes.

    All of this makes it sound like it’s impossible to cache a site that uses affiliate cookies, but I can’t say for sure that’s true. It really depends on how the plugin processes the cookies. I don’t know enough about how the affiliate plugin works to be able to give you a straight answer.

    If you can tell me a little bit more about how the cookie is originally set, what happens to the cookie while a visitor navigates your site, and what happens when an order is placed, I can probably be more specific. It’s possible your site could be set up to use the cookies as a “cache vary” like in that forum post I linked to earlier. In that case, the pages could still be cached, only those with affiliate cookies would get a different publicly-cached copy of the page than everyone else.

    But, like I said, it’s impossible to know without understanding more about the plugin you’re using.

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    I’ve been on the AffiliateWP site, and according to their FAQ, their system works with cached sites. I didn’t dig too deeply, but I did see a reference to JavaScript. If all of the cookie-related tasks are done with JS, then there should not be a conflict with LSCache (and you should not need to exclude anything from the cache).

    I suggest you contact AffiliateWP’s support just to be sure, but if it’s a 100% JS-based solution, then you don’t have to do anything on the LSCache side to make it work.

    [You do still have to be careful if you are doing any JS optimization (combine/minify, etc.) Make sure you test that thoroughly, because JS/CSS optimization features are not always compatible with every plugin!]

    Thread Starter andrew55

    (@andrew55)

    Lisa,

    That’s good news about AffiliateWP. I will check with them to make sure.

    As far as…

    LSCache doesn’t cache static content like images in the first place

    …I’m recently switching over to LiteSpeed Cache from W3TC. Maybe I’m understanding it wrong, but I believe page cache in W3TC cached images, text, etc, resulting in faster loading speeds.

    Are you saying that images aren’t cached (server side) with LiteSpeed Cache? Our site is image heavy and we need to have as many images cached as possible.

    If not, do you have a suggestion for a compatible plugin for caching images, text, etc.

    Thanks for any help.

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    Are you saying that images aren’t cached (server side) with LiteSpeed Cache? Our site is image heavy and we need to have as many images cached as possible.

    Correct. LSCache is a full-page cache, which means in this case we take dynamically-generated PHP and save it as HTML. Images and other static content, like JS or CSS, are not cached at the server level.

    W3TC doesn’t cache images at the server level, either.

    If you want to cache images, you need to either use a CDN, or browser cache to store the images locally on the visitor’s device. You probably had browser cache set up with W3TC, though it’s possible they didn’t call it that. I’m not sure.

    You can enable browser cache with LSCWP in the Settings > Advanced tab. Learn more here.

    We also have CDN support built-in to LSCache, so if you went that route, you can set it up on the Settings > CDN tab. Learn more here.

    I hope this is helpful!

    Thread Starter andrew55

    (@andrew55)

    Lisa,

    Very helpful. Thank you for clarifying everything.

    Plugin Support LiteSpeed Lisa

    (@lclarke)

    You are welcome! Glad I could help 🙂

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘cookies cache’ is closed to new replies.