• Resolved ccgjosh

    (@ccgjosh)


    We use PHP to get the referring page ( $_SERVER[‘HTTP_REFERRER’] ) to help track form conversions. While this method works great on other websites that we’ve built (and host on the same server), we are having a problem with one of our sites where this information is not being tracked properly.

    I created a custom plugin and added this code to record data to the error_log:

    add_action('init', 'GF_User_Tracking::test_error_log');
    class GF_User_Tracking {
    	function test_error_log() {
    		error_log( print_r( $_SERVER, true));
    	}
    }

    After clearing the cache, the proper data is stored. However, once the cache has been created for a page, visiting that page is not recorded in the error_log. The same thing happens when I disable cache entirely.

    I suspect it’s due to a setting or perhaps a conflicting plugin but I wanted to reach out first before diving into the issue.

    • This topic was modified 4 years, 2 months ago by ccgjosh.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    The same thing happens when I disable cache entirely.

    wait a second , the issue still happens with cache plugin disabled ?

    which server envs you can see if you create a phpinfo page ?

    Best regards,

    Thread Starter ccgjosh

    (@ccgjosh)

    Sorry, I should have been more clear — when the cache is disabled, the error_log shows the correct data.

    PHP info can be viewed here.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    okay , then that makes sense

    when page is cached, PHP will NOT be running at all , so it won’t log it out

    you may need to invoke ESI for this

    if you use ESI , you can use “$_SERVER[‘ESI_REFERER’]” to get the refer link from parent URI

    Best regards,

    Thread Starter ccgjosh

    (@ccgjosh)

    It looks like simply enabling ESI has solved the issue. I will keep an eye on it and do more research if needed. Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Missing $_SERVER information’ is closed to new replies.