• I created a custom plugin that sets a cookie with the value of the HTTP_REFERER value only if the value isn’t a URL for an internal page so it is capturing external website referral URLs.

    However it appears either the way WordPress or the Divi Theme works, the HTTP_REFERER value always gets set to a CSS file on the website! Wondering if there is any way around this so I can set a cookie with the referring URL of the external website?

    Example:

    https%3A%2F%2Fwww.somedomain.com%2Fwp-content%2Fet-cache%2Fglobal%2Fet-divi-customizer-global-15755732849498.min.css

    Is there no way of getting around this when using Divi? Is this a WordPress issue and not a Divi issues?

    Code example:

    function dtfn_init_actions(){
    
    	if(!session_id()){
    		ini_set('session.gc_maxlifetime', 3600*24*30);
    		session_start();
    	}
    
    	if ((! strstr($_SERVER['HTTP_REFERER'],'somedomain') or $_REQUEST['source']) and !isset($_COOKIE['source']))
    	{
    		if (!isset($_REQUEST['source']))
    		{
    			setcookie('source', $_SERVER['HTTP_REFERER'], time() + (86400 * 30), "/", ".somedomain.com");
    		}
    		else
    		{
    			setcookie('source', $_REQUEST['source'], time() + (86400 * 30), "/", ".somedomain.com");
    		}
               }
     }
    
    add_action('init', 'dtfn_init_actions');
    • This topic was modified 4 years, 11 months ago by Jan Dembowski.
    • This topic was modified 4 years, 11 months ago by bcworkz. Reason: code fixed
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Can’t Get External Site HTTP_REFERER (Divi Theme)’ is closed to new replies.