Support » Plugin: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce » Varnish Cache and Enhanced WooCommerce Analytics

  • Resolved Rhand

    (@rhand)


    Dreamhost / DreamPress uses Varnish caching and I was told “..the site is also not caching due to a session being served up by the enhanced-e-commerce-for-woocommerce-store plugin
    How can I turn off sessions or make your plugin work well with Varnish caching? Is this due to the impressions threshold settings?

    • This topic was modified 3 years, 7 months ago by Rhand.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Tatvic

    (@tatvic)

    Hi,

    Thank you for writing us!

    This is strange because ideally, it should work. To find the exact culprit (if it from our plugin or not). we need to test it thoroughly from the backend so we request you to contact us at analytics2(at)tatvic(do)com & share some more details over there.

    Hope to hear you soon!

    Thanks & Regards,

    • This reply was modified 3 years, 7 months ago by Tatvic.
    Thread Starter Rhand

    (@rhand)

    The code from the plugin that is generating the sessions are:

    ./wp-content/plugins/enhanced-e-commerce-for-woocommerce-store/includes/class-wc-enhanced-ecommerce-google-analytics-integration.php:
           //session_start inserted bcoz it gives warning
    ./wp-content/plugins/enhanced-e-commerce-for-woocommerce-store/includes/class-wc-enhanced-ecommerce-google-analytics-integration.php:
             session_start();
    ./wp-content/plugins/enhanced-e-commerce-for-woocommerce-store/readme.txt:
    * Fixed - session_start() function warning 

    So this is where they would want to start with evaluating their code,
    when the plugin is deactivated, when you check the headers, the
    x-cacheable statement changes from ‘no’ to ‘yes’. For example

    The plugin is activated:

    curl -I imwz.io
    HTTP/1.1 301 Moved Permanently
    Server: Apache
    Set-Cookie: PHPSESSID=1c863b94e3941ead02fefb90d5d25661; path=/
    Pragma: no-cache
    X-UA-Compatible: IE=edge
    Expires: Thu, 03 May 2018 17:38:44 GMT
    Cache-Control: max-age=3600
    Location: https://imwz.io/
    Vary: Accept-Encoding
    Content-Type: text/html; charset=UTF-8
    X-Cacheable: NO:Not Cacheable  
    Date: Thu, 03 May 2018 16:38:44 GMT
    X-Varnish: 1726013340
    Age: 0
    Connection: keep-alive

    And with the plugin deactivated:

    curl -I imwz.io
    HTTP/1.1 301 Moved Permanently
    Server: Apache
    X-UA-Compatible: IE=edge
    Expires: Thu, 03 May 2018 17:35:57 GMT
    Cache-Control: max-age=3600
    Location: https://imwz.io/
    Vary: Accept-Encoding
    Content-Type: text/html; charset=UTF-8
    X-Cacheable: YES
    Date: Thu, 03 May 2018 16:38:08 GMT
    X-Varnish: 2121086199 2121086155
    Age: 131
    Connection: keep-alive
    • This reply was modified 3 years, 7 months ago by Rhand.
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    It’s going to be this:

    https://plugins.trac.wordpress.org/browser/enhanced-e-commerce-for-woocommerce-store/trunk/includes/class-wc-enhanced-ecommerce-google-analytics-integration.php#L35

    Since that’s in public function __construct() and you call the class that’s in on every page load per https://plugins.trac.wordpress.org/browser/enhanced-e-commerce-for-woocommerce-store/trunk/woocommerce-enhanced-ecommerce-google-analytics-integration.php#L31 … Yeah.

    Using session_start() or ob_start() in your plugin without having it encapsulated in a function means that it will run on every single page load when your plugin is active. That means you’ve just broken caching for everyone because the way PHP Sessions work is they indicate the visitor using sessions is unique and should have a non-cached view of the website. This specifically breaks Varnish type caching.

    The correct way to handle this would be to put the sessions call such that it’s only run when a unique pass is needed. Since you’re doing analytics via Sessions, this may just not be compatible with Varnish, Nginx, or other similar server side based cache systems.

    Plugin Author Tatvic

    (@tatvic)

    Hi Mike,

    Thank you for your time & explanation!

    We’ll look into it & do the needful for this culprit.

    Thanks & Regards,

    Thread Starter Rhand

    (@rhand)

    Any news on this? Deactivated the plugin, but would love to use it again once it is working properly @tatvic .

    Plugin Author Tatvic

    (@tatvic)

    Hi,

    We have tried from our end but as Mike has mentioned, we are doing analytics via Sessions for GA & in GA, maintain sessions are very important so it’ll not work with server-based cache systems.

    For more information, contact us at analytics2(at)tatvic(dot)com

    Thanks & Regards,

    Hi Tatvic,

    Any more update on this? In order to continue using your plugin, we need to have this resolved.

    We checked with the latest version of your plugin (as of this writing) and the plugin still breaks server side caching.

    Hope you can fix it, really like the plugin otherwise.

    Plugin Author Tatvic

    (@tatvic)

    Hi @spere,

    Thank you for writing to us!

    Unfortunately, we haven’t found any solution for this. As you can read in the thread, we are doing analytics via Sessions for GA & in GA, maintain sessions are very important so it’ll not work with server-based cache systems.

    If you still want to use our plugin then we can do some patchwork especially for you but after that, you have to bear with the Product position data on the listing pages.

    If you are interested then contact us at analytics2(at)tatvic(dot)com so we can assist you further.

    Thanks & Regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Varnish Cache and Enhanced WooCommerce Analytics’ is closed to new replies.