lscache_wp
lscache_wp copied to clipboard
_lscache_vary - cookie and page referrer
We use Guest Mode with Guest Optimization. And we face an issue with google analytics because on first visit.
When user comes to our site for the first time, no matter where he comes from in Google Analytics source displayed as "Direct".
It happens because of this JS - guest.js
var litespeed_vary = document.cookie.replace(/(?:(?:^|.*;\s*)_lscache_vary\s*\=\s*([^;]*).*$)|^.*$/, "$1"); if ( ! litespeed_vary ) { // Note: as the vary may be changed in Login Cookie option, even the visitor doesn't have this cookie, it doesn't mean the visitor doesn't have the vary, so still need PHP side to decide if need to set vary or not. fetch( 'litespeed_url', { method: 'POST', cache: 'no-cache', redirect: 'follow', } ).then( response => response.json() ).then( data => { console.log(data); if ( data.hasOwnProperty( 'reload' ) && data.reload == 'yes' ) { **window.location.reload( true );** } } ); }
After reload site referrer is set to the current site.
hi. how can I fix it? and I have a problem with _lscache_vary. cause bots are not crawling with these settings. how can I fix this?