• Hi !

    Is there any experience out there in regard to Amazon Link and Cache Plugins? Something weird is definitely going on here. I had Amazon Link working fine and selecting links depending on country. Later, I installed WP Total Cache which sets various Caching modes to optimize load times (and get better ranking in Google Page Speed etc)

    A few days later, I suddenly realized that while everything was working fine on my PC where I am logged into my site in Firefox (showing amazon.de links/searchboxes), Safari on my ipad or Google Chrome on my PC would show me the amazon.com searchbox or links. At first I thought it was a browser problem but then I realized that it was an issue with the Cache plugin.

    I turned off all caches now and suddenly it works again (on all browsers)

    The weird thing is that even if I empty all client browser caches, the country detection still had problems unless I deactived the caches in the plugin.

    So is there a guide or experiences available on using cache plugins with amazon link? Like certain settings I have to set for the various caches, scripts I have to exclude etc etc

    Thanks for your help !
    Alex

    https://www.ads-software.com/plugins/amazon-link/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    As you have discovered, localisation is not compatible with most cache plugins.

    The first visitor to the site will get the correct localised version of the page, this is stored in the cache. Then another visitor from another locale visits, but the cache will serve the previous version as it is not locale aware.

    Possible ways around this:

    1/ Make the Cache locale aware, so that it caches a different version of the page for each locale.

    2/ Add functionality to the Cache plugin to always run certain filters even on the cached page output.

    3/ Disable Caching on pages that have localised data.

    The Amazon Link plugin includes a simple cache option that caches data on a per local basis.

    Paul

    I am on the same quest, i really like this plugin, but found it difficult to use with caching plugins. As Paul mentions it is possible. I have successfully created a setup that makes the cache locale aware and i made a small preload script. The plugins used are

    • WP Super Cache – The actual caching plugins
    • Country Caching Extension for WPSC – The extension for WP Super Cache that makes it locale aware
    • Category Country Aware Goodies – Plugin that updates the same ip to location database that the Country Caching Extension uses. Keeps the location info up to date
    • Amazon Link – To create the localised links
    • Amazon Link Extra – Spoof Locale – Needed by the preload script to create the localised cache entries
    • WP-CLI – Used to extract blog post urls and status from WordPress

    A quick step by step guide can be found on my blog at this post: https://odd-one-out.serek.eu/2015/05/amazon-affiliate-link-wp-super-cache-preload/

    It is by far perfect, it will create a cache entry for each country that visits your post or that is defined in the preload script. Until i find a better way this is what i use.

    @paulstuttard: Is it possible to add an option for Amazon Link to create these links using javascript so that the actual localised links are created on the fly? It could store all link variants in the html file itself. I am not sure this is a feasible way to go.

    /Poul

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    Thanks for finding a workable solution to this particularly knotty problem!

    I did do a javascript version of the plugin, but it was based on AJAX calls (i.e. populate the links on the client side using ajax calls back to the server for each link).

    It kind of worked, pages loaded quickly then links were filled in more slowly, but not very satisfactory experience if the amazon link content is core to your page layout.

    Also because all the links are processed individually it actually put more load on the server. So works well for low traffic sites, but probably a headache once visitor numbers increase.

    I’ve not considered your proposal before, partly because the initial page fetches would take an immense amount of time, N links * M locales fetched. But in the context of preloading the site and using a third party cache it makes a certain amount of sense.

    How do you do the initial site fetch? Just manually walk the whole site for each locale?

    Paul

    Hi Paul

    Yes, the initial preload is just looping every post URL and for every post URL loop the country locales and request the localized post URL to create the cache entry using ?spoof_locale=XX. A simple solution that works fine for small sites, but for large sites the cache will get very large.

    It is possible to define in the geo cache plugin which countries to create localized cached page for. Every other country not defined here will get the same default cache entry. So if one only uses Amazon Link to create localized links to US, UK and DE and everything else defaults to US, then one can get away with only 4 cache entries per post (the 3 localized and one default which is the same as the US)

    /Poul

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Experiences with Cache Plugins (WP Total cache ..) ?’ is closed to new replies.