Comments on Speed Up Google Analytics

Speed Up Google Analytics This method uses crontab to execute a shell script that downloads an updated urchin.js file every 24 hours and saves it into your local sites directory. Thats it! The problem occurs when google-analytics.com/urchin.js is requested by billions of web users all over the world at one time, it can cause your sites pages to load at a snails pace. Especially if you are using WordPress or a similar CMS.

1 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By:

Prehaps one could use something like this to check if urchin.js was downloaded successfully and only then update the local version.

#!/bin/sh
WHERE='/home/glisha/js'
wget --quiet -O "$WHERE/urchin_temp.js" http://www.google-analytics.com/urchin.js

if [ "$?" -eq "0" ]; then
    chmod 644 "$WHERE/urchin_temp.js"
    cp "$WHERE/urchin_temp.js" "$WHERE/urchin.js"
fi;
rm "$WHERE/urchin_temp.js"
exit 0;