Cookie issue with flyingpress cache plugin

I’ve read most of the documentation about plugins and issue, etc. My issue is that with FlyingPress enabled, the “affiliates enterprise” plugin doesn’t seem to set cookies.

The owner of FlyingPress said this: “The “ref” in our default ignore parameters. Most such affiliate programs have to option to set cookies via AJAX. Can you check if that’s available?”

Do you have the option to set cookies fir AJAX?


Comments

9 responses to “Cookie issue with flyingpress cache plugin”

  1. That’s good Michael.

    The _h_affiliates is a hash of the affiliate id, that is also stored as a cookie when a hit is recorded for an affiliate’s link. I think you should have a look at the affiliates_record_hit function.
    Even though I haven’t tried it myself, it should be possible to set that cookie too.

    Kind regards,
    George

  2. Hey Michael,

    I’m not pretty sure how their options work, but I would expect a page with an excluded param to be excluded from caching. The URL parameter can appear on every page depending on which link does a lead follow, aka which link does your affiliate share. If the lead follows ie http://www.example.com/shop/?affiliate=123, then the cookie should be set once the lead reaches the shop page. This is why I didn’t mention the page in the first place, but the URL parameter.

    On the other hand, it’s not necessary to exclude every page but only avoid caching the page that includes the URL parameter carrying the cookie. Once the cookie is set, then every subsequent visit on your site won’t have that URL parameter and therefore will be cached properly. This way you store the necessary cookie and also have the benefits of caching.

    Kind regards,
    George

    1. Michael Avatar

      Yes, with my fix of changing the query to “refid” this is exactly how it’s working as of right now. This is the best compromise I see without being able to completely cache the page and set the cookie(s). Unfortunately, it’s that first page load that’s a bit slower… first impressions can mean a lot in ecom.

      On a side note, for my landing pages done in another builder off my main site, I have used Javascript code in Google Tag Manager to set the “wp_affiliates” cookie. I could incorporate that on my main site and get the best of both worlds. The only issue is that I now see we are setting another cookie that looks random, “_h_affiliates”. Is there any way I can also set that cookie via an external Javascript that would work properly?

  3. Michael Avatar

    I may have worded that incorrectly… The plugin ignores “ref” by default meaning that it will go ahead and cache the page. When it caches the page, the cookie isn’t getting set.

    My fix of changing the query to “refid” works in the sense that now FlyingPress will not cache any page where it sees that in the query fields.

    The issue there is of course that the pages with that will not load nearly as fast. I am working with the creator of FlyingPress to see if we can fix this issue somehow.

    Another thing I see is that there are no files being loaded from the “/affiliates-enterprise/” directory even with FlyingPress disabled: https://nimb.ws/s8rRlZ

    What seems to be setting the cookie is the main page/code: https://nimb.ws/pRLNYg

    I’d love to figure out how to make it all work properly together.

  4. Hey Michael,

    FYI, if the parameter is ignored, then the cookie should be there. This is how other caching plugins work, like W3 Total Cache and WP Super Cache.

    For that reason, you shouldn’t need to exclude specific files from caching. However, you can check with the browser inspector, which files are cached, if any, and proceed to exclude them. As a failsafe, you can exclude all files under the plugin folder, using wildcards.

    Kind regards,
    George

  5. Michael Avatar

    The query “ref” isn’t excluded from caching… it’s “Ignored” by default so they cache the page by default.

    I’ve changed the query I use to “refid” which is a temporary fix that worked fine except having to have 100’s of affiliates change their links…

    The biggest issue is that I would like to get the cookie to be set properly “AND” I’d like the page to be able to be cached as well because it’s SOOO much faster that way.

    Can you explain which file does the caching, maybe that would help us exclude it in FlyingPress?

  6. Hey Michael,

    Since you’re already using the ref keyword as the affiliate URL parameter and it’s already excluded from caching, then something else is conflicting with the process.

    Let’s see what can the developer of FlyingPress recommend about this.

    Kind regards,
    George

  7. Michael Avatar
    Michael

    Thank you for that reply.

    However, I changed the query I use to “ref” a long time ago, see this: https://nimb.ws/vSkDw5

    It has worked this way fine for years (before installing FlyingPress). I have a lot of links out there already using “ref” so it would be a pain to change that if I had to.

    Unfortunately, FlyingPress ignores the “ref” query string by default and only has an option to “ignore” specific query strings that you enter not the other way around. I am asking the owner if there is a way to do this or a filter or something (no answer yet).

  8. George Avatar

    Hi Michael,

    The ref parameter is pretty specific and is not supported by Affiliates plugin. Instead the plugin is using its own parameter which helps avoiding conflicts. If you check under Affiliates > Settings > General, you can find the affiliate URL parameter(default is affiliates) that should be excluded from caching in FlyingPress settings. Furthermore, according to FlyingPress documentation you should be able to specify the query parameters that should be excluded from caching, so this should be pretty easy.

    Last but not least and beyond this support request, you should also make sure to renew your license by buying the plugin. An active license gives you access to support and updates for the plugin and most importantly contributes to the continuous maintenance of the plugin.

    Kind regards,
    George

Share