Category Archives: Google Analytics

First Glance Comparing New vs Old Google Analytics Tracking Codes

I installed the new ga.js tracking script on this blog a few weeks ago and decided to take a look today to see if there are any reporting differences. Here’s what I found for the same time period:

Google Traffic
  Old New
Total Visits: 1293 1047
Pages Per Visit: 1.28 1.57
Avg Time on Site: 00:00:23 00:01.01
Unique Referring Phrases: 783 765

Here’s a couple of screenshots of the top referring phrases. You can clearly see the differences.

Google Analytics Referring Phrases (Old)

Google Analytics Referring Phrases (New)

So as you can see, there’s quite a discrepancy, even for my site which doesn’t get a lot of traffic at all. I think I’m going to have to dig into this further and compare these stats with log files to see which is more accurate. I also want to make sure that the tracking codes really do appear on every page, to make sure that isn’t skewing the stats somewhat.

I’ll post back again when I find more info. If anyone else is doing a similar test, what are you finding?

Google Analytics 404 Tracking And Downloaded Files

I was reading Bruce Clay’s September Newsletter and came across a couple of inaccuracies in Jim Sterne’s web analytics article, specifically this part:

Google won’t report on downloads of files like PDF’s, jpg’s of Flash. You want to know about server error messages? You have to look to the pay-to-play vendors.

Well Google Analytics may not give you those reports out of the box, but it’s not too difficult to put these two solutions together:

1) Tracking files downloaded from your site:

Caveat – this method only reports on people clicking links on your website which are tagged with this code. If someone remotely links to a file on your site, none of the javascript web analytics packages will report on that traffic.

2) Tracking 404 error pages:

This could also be used to create error pages and tracking for 5XX errors.

And on a side note, for those of you who use WordPress, here’s a handy way to create a custom 404 page:

If you have your Google Analytics code in a footer include file, you could create a second include and call it from the 404.php.

Google Analytics Gets Hourly Reporting

I love the new version of Google Analytics, but the missing hourly reporting was a frustrating omission, but not anymore. Google has updated the functionality with some new features:

1) Hourly reporting
2) Clickable URLs
3) Cross Segmentation by Network Location
4) Increased number of data rows per page
5) Bounce Rate increase/decrease colors switched
6) Easier AdWords Integration

Google Analytics Authorized Consultant (GAAC) Requirements

I looked into this a while back and wrote to Google Analytics support. They responded with this set of requirements for becoming a Google Analytics Authorized Consultant:

  • In business for 1 year
  • At least one dedicated person for Google Analytics support
  • Must provide full service i.e. setup, support, training, and consultation for Google Analytics
  • Must have an online ticketing system that Google can access
  • Must provide support for both Google Analytics and Urchin software
  • Must have a web site of sufficient Google Analytics/Urchin content and quality
  • Proven background in Analytics and Search Engine Marketing (SEM)
  • Must have at least one Google Adwords Certified employee
  • Must attend training sessions at a Google office – usually once per year

While I have most of these items covered, I just need to find another 6 hours in a day and I may be able to get the rest done.

Google Analytics Developers, Please Update urchin.js

I was looking through an overall keyword conversion report in Analytics and noticed some strange search phrases appearing. They looked like long strings of random numbers and characters. It turns out that AOL must be testing some new URL structure in the search results and changed the variable that identifies the search query. I took a look at the urchin.js and noticed that the new query variable (userQuery) is not included.

The urchin.js file currently has these variables to define AOL:

_uOsr[3]="aol"; _uOkw[3]="query";
_uOsr[4]="aol"; _uOkw[4]="encquery";

To track the new AOL search queries just place these 2 lines before the urchinTracker() function in your Google Analytics tracking code:


Update: I replaced the manual insertion of elements into the _uOsr and _uOkw arrays with the push() function which is a much better solution.

New Version of Google Analytics Coming

Yes, a new version is soon coming.

I haven’t yet seen it, but I’m hoping that it has a report which shows the full URL including all the parameters by default and/or doesn’t mess with the Google Analytics hack I put in place. I guess I’ll find out when one of my accounts get converted in the coming weeks. I’ll keep an eye out and post any observations/modifications to the javascript code as soon as I have it figured out.

Google Analytics Tracking Code – HTTPS and Full External Referrer Only

Part 1 – Detecting http and https Mode Using Javascript
A while back I came across a scenario where a website (typically an ecommerce site) can serve part of their website in both http and https mode. These sites typically use the same template or footer include file for both browser modes. This causes a security alert popup in the browser because the remote javascript file is called using a http request. While this isn’t a security threat, it could cause some less technically savvy users to be concerned about the site security and perhaps not want to complete the transaction.

Google does offer the webmaster the ability to request the urchin.js file using a https call, which works well, except what we really need, is a way to detect which mode we’re in, then make the appropriate request on the javascript file.

With help from some members on SEORefugee we figured out how it can be done.

Part 2 – Only Obtaining External Referrers
Sunday night I was looking through my Top Content report and realized that after my hack to obtain the full referrer, it’s fairly indiscriminate and will obtain all referrers, both internal and external. While I already knew about this, I guess that night I was tired and grumpy and it just bugged me enough to want to fix it.

The whole point of my hack was to obtain the external referrer, so I came up with some more javascript to detect whether the referrer is internal or external and write out the urchinTracker function accordingly, so it will only record the external referrers.

The Grand Finale
So putting all this together we get this:

Just replace the XXX’s with your Analytics account number and “” with your website.

Testing Google Analytics Regular Expressions In Real Time

If you have a dynamic website and want to set up conversion goals within Google Analytics, you may need to use regular expressions to define the goal page.

These are extremely useful because they can be used to match specific sequences of characters in a URL. They’re a huge expansion on the common wildcard characters * and ? and tend to work out very well for ecommerce websites.

Here’s a typical example of how you can use them to great effect. Usually when you set up a conversion goal you have to specify a goal URL, that is, a page the user gets to which triggers that a conversion has taken place. In the case of an ecommerce website, it would be the receipt page, or “thank you” page once the user has purchased something. But in many cases the URL of that page is dynamic and may contain OrderID or CustomerID variables. Since this page changes every time, we need to use a regular expression so we can match the URL regardless of the value of those variables.

If you’re new to Google Analytics, you probably started off setting up a goal with your first attempt at a regular expression, going to your website to complete a test transaction, waiting approximately 3 hours then checking your stats. Not exactly the most efficient way of going about things, especially if you’re new to regular expressions.

If that’s the way you normally do it, here’s a massive time saving tip. You can test your regular expression live on previous data and it will take you just a matter of minutes to complete the goal.

1) Once logged in to Analytics, go to Content Optimization > Content Performance > Top Content
2) In the filter at the top of the screen enter your regular expression and hit enter.
3) Look at the content results and keep fine tuning your regular expression until you see the desired match appear

Here’s a real example used on an ecommerce site. The regular expression I used to filter the data was:

Click on the image to see a screenshot of the results:
Google Analytics Regular Expression Example

Just be sure to scroll through all results, to make sure it didn’t pick up anything else, otherwise your conversion stats will be overinflated.

More Help
Google Analytics Regular Expressions Syntax
Conversion University
Google Analytics Support Pages
Google Analytics Google Group

Edit: Corrected syntax, thanks Mark.