• Resolved borndigital

    (@borndigital)


    Server information such as $_SERVER[‘HTTP_REFERER’] and $_SERVER[‘HTTP_HOST’] are not displaying proper information when the W3 Total Cache plugin is enabled. I tried disabling various features of the plugin, but it didn’t help. Only when the plugin is completely disabled, does PHP display proper server info.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @borndigital

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Can you please share how you are using those?
    Also, can you share a screenshot with and without W3 Total Cache enabled?
    Please let us know more details so we can assist you with this.
    Thank you!

    Thread Starter borndigital

    (@borndigital)

    Hi Marko,

    We have a tracking script that tracks the landing page the user landed on and where they came from (referral URL) / traffic source. It’s failing specifically for ‘Direct Traffic’.

    With the plugin is turned on, we get this information:

    {“Traffic+Source”:”https:\/\/domain.com\/wp-admin\/admin.php?page=w3tc_pgcache”,”Landing+Page”:”https:\/\/domain.com\/wp-admin\/admin-ajax.php”}

    Sometimes the URLs will change, and we’ll get other cached resources, such as a Contact 7 plugin resource: https://domain.com/wp-json/contact-form-7/v1/contact-forms/77/refill

    When the plugin is deactivated, it works as expected:
    {“Traffic+Source”:”Direct”,”Landing+Page”:”https:\/\/domain.com\/”}

    Here is the PHP code snippet:

    
    if (empty($_SERVER['HTTP_REFERER'])) {
    
          $lead_info['Traffic Source'] = 'Direct';
    
    } else {
    
          $lead_info['Traffic Source'] = $_SERVER['HTTP_REFERER'];
    
    }
      
    $lead_info['Landing Page'] = 'https://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?');
    

    Thank you for your help!

    • This reply was modified 6 years, 2 months ago by borndigital.
    • This reply was modified 6 years, 2 months ago by borndigital.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @borndigital

    Thank you for the information.
    Does the issue persist if you disable Page cache?
    Have you tried excluding those pages from the cache?
    Thanks!

    Thread Starter borndigital

    (@borndigital)

    The issue does persist if we disable Page cache. In fact, the issue remains when we uncheck (disable) all caching options on General Settings tab. Only when plugin is deactivated on plugins page, does the issue go away.

    If we exclude specific resources from cache – we just find other cached resources being displayed as incorrect information.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @borndigital

    Can you please share your website URL?
    ANd to confirm you are using your custom script for this instead of google analytics or some other solution?
    THanks!

    Thread Starter borndigital

    (@borndigital)

    Website URL: https://securerecordssolutions.com/

    We use Google Analytics on the site. Our script is for additional tracking purposes.

    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @borndigital

    Google Analytics is working fine with W3 Total Cache. Since this is a custom solution I can’t say what might be causing the issue.
    So to check this, we need to replicate the issue and we need step by step instructions to do this so we can replicate the issue as it is on your end.
    thank you!

    Thread Starter borndigital

    (@borndigital)

    Place the above code I provided in the body of any WordPress theme file. And log the output of this array variable: $lead_info.

    You should see the output is different when 1) W3 Total Cache plugin is enabled; and 2) W3 Total Cache plugin is disabled.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @borndigital

    Thank you for your patience.
    I’ve spoken with the developers and the problem is that, as you already know PHP is not executed. that’s what caching does and why it’s effective so giving that the cache is active PHP is not fired.
    The only solution for this is to use ajax calls.
    Thank you!

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

The topic ‘Server Info Not Displaying Properly’ is closed to new replies.