Please download the test.zip again because the test.php contained an error and then try again.
If the cache the test.php works, but Mediawiki does not and the GA code is the same everywhere, then the conclusion can only be that the code for implementing the GA extension cannot be right. Have you ever tried to completely remove the GA extension? So not only disable but completely remove!
Re-uploaded the corrected script, still puts the cookie on and still seems to cache just fine.
The GA extension in localsettings.php is simply called like this:
Code:
wfLoadExtension( 'GTag' );
$wgGTagAnalyticsId = 'G-60WQVKGFXH';
I had just added ## before each line to comment it out, but I have gone ahead and totally removed it just to make sure. Still no joy -- will not cache so long as that hook is putting the script in.
Very frustrating, because everything says it should work. Is there any chance that something in the LiteSpeedCache plugin is at fault? Maybe... could it be seeing the state of the page before the hook, and when it compares to the hook version it says, "Well, this is totally different, cache miss"? But the it caches the post-hook version, so it will never actually hit the cache...
But that doesn't make a lot of sense, because I have other stuff in hooks like meta-tags, and those presented no problem. It's specifically scripts that set cookies that seem to be an issue. I even had a script for geni.us links to automatically rewrite links to Amazon to affiliate links...
Actually, that leads to a thought. I will put the hook near the top of LocalSettings.php, and see if anything changes.
ETA: Nope, no change. Of course, Mediawiki's own execution order may not depend on where things are placed in LocalSettings.php. I will have to check and see if that is discussed anywhere.