About a month ago, Starr Horne and I launched a reboot of OfficeSpace.com, which is all about helping people who are looking for office space find it. We've had a lot of fun trying out various techniques and technologies, including trying different approaches to analytics.
I was very interested in tracking on-page events, in addition to the usual page views, etc., so of course I implemented events tracking with Google Analytics. I also wanted to track those events internally, so along with the call to GA, I make a post ajax request to a Rails metal controller that logs the events in Redis. For example, when the map view gets loaded, pins get dropped on the map for buildings that have available office space, and a trigger is set on the markers to pop up a dialog with more info about each building. When the click event fires, json is fetched, the dialog is displayed, and a post is sent to the stats collecting controller to track an event for previewing a building. Since the request was a post and was triggered by javascript, I thought that only humans would trigger it. As I watched the logs, though, and saw googlebot posting to the stats tracker with data from the pages it was loading, I realized how wrong I was.
So now I'm a little wiser and a little more rigorous about keeping bots from creating data they shouldn't be creating. I'm also now more curious about just how much dynamic content googlebot can index. :)
]]>Since capistrano creates a symlink for the assets that is moved across deploys, you really don't need to compile those assets for any deploy where the assets didn't change. Instead, all you need to do is move the symlink. However, the default capistrano for compiling the assets does compile them every time, regardless of whether any assets were changed in the set of commits that you are deploying. The trick, then, is to check the list of files that were changed in the range of commits that are being deployed, and compile the assets only if assets show up in that list. And here is a code snippet that does exactly that:
It only supports git, as that's what I use, so if you use git, just drop that snippet into deploy.rb and enjoy quicker deployments.
]]>Since I deploy everything with Chef, I threw together a quick Chef recipe to automate the installation of New Relic's server monitoring agent. It has been tested with Ubuntu 10.04 LTS, and you can configure the license key in your Chef JSON config.
You can grab the recipe from my Chef recipe repository at Github.
]]>You can also now see a list of bundles that your tracking, once you've logged in via Github. This list shows you at a glance which gems have been updated for your bundles.
]]>This release finishes the conversion to I18n. Just about everything is in the locale files now, including the ability to define custom formats for everything -- company names, street addresses, etc. And, with the magic of method_missing, you can add new items to your locale file and have them show up as methods in the Faker classes.
The 1.0 release also settles some long-standing issues people have had with bad interaction between Faker, Rails 2.3, and locales (especially fallbacks). Though I'm not actively seeking to support Rails 2.3, I at least don't want it to be broken, so this release should cover that. Both Ruby 1.9.2 and 1.8.7 are fully supported.
Finally, I want to send out a big "thank you" to everyone (and there are a lot of them) who contributed code and ideas to this release. I really appreciate the interest shown and the work done by so many people who use and love Faker. According to rubygems.org, it has been installed over 400,000 times — over 1,000 times in the past few days!
Of course, I'm not done yet... next on the feature list is Faker::Image, which will provide an interface to all those cool fake image generator services out there. :)
]]>