Something for the weekend

This job ad popped up in my RSS reader today and the word ‘puzzle’ in the title was an irresistible challenge.

My initial guess at a solution wasn’t right, but after looking a bit more closely I realised how it worked and what I needed to do. I’m happily employed at the moment so won’t be sending off my answer, but I may post the solution I came up with in a month or so, after real applicants have had a fair go of it.

Recently I also came across a web development company that had a string of binary hidden in the header of the site, that translated into an invitation to go to the jobs section of their site to apply. It’s great finding these little puzzles but I wonder how effective they are at recruiting people.

Stop Google Analytics from counting Admin visits on WordPress

As a designer one of the most annoying things about developing and maintaining a WordPress theme is that Google Analytics counts every visit from your machine, even when your just working on an offline development sever as I do. This is especially crucial when a site is launching and all the visits from the local server can throw your stats way off, as seen in the image here.

There are a few existing ways to stop Analytics from counting your visits, one of the best is by using this method on HubPages that gives your browser a name and then creating an exclude filter on Google Analytics.

It’s a good method but it doesn’t work cross-browser and involves some tinkering on the Analytics backend. The method I use, uses PHP to check if the current user is an Admin and inserts a link to the WordPress admin panel. If the user isn’t an Admin it loads the Analytics code instead.

Don’t forget to change the UA-000000 to your own Analytics ID. You can change the first line to exclude Editors and Authors by changing the current_user_can function, have a look at the Capability vs. Role table in the WordPress Codex. You also can completely remove the second line if you don’t want or need a link to the Admin panel, but I found it a useful visual indicator that the code was working.