This weekend David Eckman of VKI Studios sent me an email about RIAForge. His company makes frequent use of RIAForge, and as a provider of Google Analytic implementation services, he wanted to let me know about a problem with the way I had set up the code.

RIAForge makes use of multiple, dynamic root URLs. So you have the main URL (http://www.riaforge.org) and multiple, dynamic project URLs (http://blogcfc.riaforge.org for example). My Analytics codes was not set up properly to handle multiple domains.

I had trouble finding the exact way to generate the right code via Google's interface, but luckily David sent me the mod directly. Here is the old code:

<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-70863-8"); pageTracker._initData(); pageTracker._trackPageview(); </script>

And the modified version, note the line that sets the domain, third from the bottom:

<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-70863-8"); pageTracker._setDomainName("riaforge.org"); pageTracker._initData(); pageTracker._trackPageview(); </script>

Since these guys make their money from this type of advice, I want to thank VKI Studios once again. They were also very cool with me blogging this.