A few days ago, Google released what I consider to be their most important new product feature of the year. Google Analytics now supports asynchronous loading of its tracking code. This means that you can have all the awesomeness of Google Analytics with very minimal impact to your page load times. If you’re still not using Google Analytics on your site, go get it right now. I’ll wait.
All right. Now that you’ve got Google Analytics working on your site, replace the Javascript code tracking snippet with the following:
1 <script type="text/javascript">
2
3 var _gaq = _gaq || [];
4 _gaq.push(['_setAccount', 'UA-XXXXX-X']);
5 _gaq.push(['_trackPageview']);
6
7 (function() {
8 var ga = document.createElement('script');
9 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10 ga.setAttribute('async', 'true');
11 document.documentElement.firstChild.appendChild(ga);
12 })();
13
14 </script>
Make sure to replace the ‘UA-XXXXX-X’ string on line 4 with your site’s Google Analytics ID.
If you’d like, you can even place this Javascript at the top of your pages, since it will no longer slow down your page load times. Google had previously suggested placing it at the end of your pages, but this is no longer necessary.
That’s it! You have a shiny new asynchronous visitor tracker, and your site will be super snappy.
More details about Google Analytics asynchronous tracking can be found here.
Monday, November 09, 2009
Geekend 2009
I attended the first ever Geekend conference in Savannah this weekend. The conference was fun, but as one of only a few developers there amongst a sea of designers, I did feel a bit out of place. I decided to embrace the uneasiness and think outside my box for the weekend, and here’s what I learned.
6 comments |
Read more »
Wednesday, October 14, 2009
Signup Bot
Today we launched Signup Bot, a web service for creating signup sheets. It replaces the old-fashioned paper signup sheet with a web interface that’s simple to use. Individuals can use Signup Bot to sign people up for parties and other events. If you’re involved in a school, church, or non-profit organization, Signup Bot can help you to organize volunteers for service projects and other events.
Read more »
For a while now, I’ve been using Shoulda for testing my Rails apps. Shoulda’s killer feature is its extensive set of macros (such as should_require_unique_attributes and should_render_template) that turn complex tests into a single line of code. Some Rails plugins are starting to include their own custom Shoulda macros to simplify testing their features.
Read more »
Rails defaults to using the Prototype Javascript library, and it provides helpers to generate Javascript from within your views. This approach is great for getting started with Rails, but I’d prefer to have all my Javascript be unobtrusive. There are a few Rails plugins that attempt to make the built-in Javascript helpers unobtrusive, but after playing with a few of these solutions I decided to give jQuery a try.
Read more »