Closed (fixed)
Project:
Google Analytics
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
31 May 2009 at 09:16 UTC
Updated:
15 Oct 2010 at 22:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
mikeytown2 commentedThis patch at least provides a workaround to the issue
Comment #2
hass commentedThis may not work and create duplicate function names.
You need to think about user having caching enabled and disable the setting tomorrow. Then the file may be aggregated and additional the file is loaded from the remote site. Than all functions are defined twice. We can only solve this by clearing the cache in form save if the cache setting have changed. Should be an addition the current patch only.
Comment #3
mikeytown2 commentedHow does the above patch create duplicate function names? Main concern is
googleanalytics_cacheis set to false and googleanalytics_cron() still clears the file/js dir. The above patch prevents this.Your concern about the setting getting switched on and off valid. Would something like this inside googleanalytics_admin_settings_form_validate() work?
Comment #4
hass commentedNot duplicated PHP functions, but duplicated JS functions. If the function is named foo_track() it's in google.com/*/ga.js (remote) and local /files/googleanalytics/ga.js aggregated into 64asdas7ed1vx.js with all other JS files together. Therefore the JS function exists twice in the pages JS files. If we turn off local caching we need to clean the cache on save, not via cron only.
Comment #5
mikeytown2 commentedThinking about this more, what if we do a MD5 of the downloaded file as well, so it clears the files/js folder only when google changes theirs.
Comment #6
hass commentedHm... generally - why not, but it may create another variable. We could save the file with the md5 hash to obfuscate the file name ga.js by this way, too. But we need to clean up the cache folder on cron run. I have never investigated how core cleans up the css/js cache folders with it's bunch of files.
Comment #7
mikeytown2 commentedit just nukes the css/js dirs. Just opened an issue so it will be smarter in the future #484524: Hook for file caches.
which cache folder needs to be clear on cron, googleanalytics/?
Comment #8
hass commentedThe core JS cache folder (if JS files are have been aggregated) and the files/googleanalytics folder (if local GA caching is enabled). I think files/googleanalytics needs to be cleared first and the others afterwards. Also do not forget hook_disable()...
Comment #9
hass commented@mikeytown2: Are you working on a better patch or should we close this case?
Comment #10
mikeytown2 commented@hass I'm busy with the boost module. You know what else needs to be done (only clear aggregated if md5 changed & hook_disable), I don't have the time to fix this 100%.
Comment #11
hass commentedI'm also busy with linkchecker, but the next ga release is very close (1-2 weekends) and I do not care much if this task get solved or not.
Comment #12
hass commentedNo patch for about 1 year. Closing inactive task.
Comment #13
hass commentedPatch only resets the cache if Google changes it's file or checksums do not match. Check is done every 24 hours as before, and caching has been optimized.
Comment #14
hass commentedComment #15
hass commentedComment #16
hass commentedComment #17
mikeytown2 commentedawesome, thanks for doing this.
Comment #18
hass commentedCommited followup as I've seen there is no longer a need to clear the JS caches at all as ga.js is not aggregated anymore with core files since async version.