Google Analytics

Migrating to Google Analytics Async Tracking Code

Array

Recently Google Analytics moved the asynchronous JavaScript version of their tracking code out of beta; it is now the standard version of the code you will see when you visit your settings in Google Analytics. This is great, as it enhances the speed at which the analytics tracking code is loaded. If you haven’t done any customization to your tracking code, and you don’t have any “advanced” tagging on your site, migrating is as simple as getting the new version of the code from your profile settings page in Google Analytics (see screenshot), placing it in the <head> of your site, and removing your existing code. If you do have customizations, or you are tracking downloads, AJAX or Flash, off-site links, using Event Tracking or Custom Variables, then migration requires some additional work. This post is intended to direct you to right resources for these additional needs.

Customized Tracking Code

Customizations to tracking code can be as simple as modifying your code to track visitors across domains, or as complicated as setting custom variables or sending event tracking requests within the “tag”. Here is a text file displaying the migration of Google Analytics tracking code from the old version to the async version, using the code from this site as the example. In a nutshell, any function that previously was called with the “pageTracker.” prefix, is now wrapped in _gaqPush[] . The code on this site has been modified to trigger an event for every post viewed, to track who the author was. Read this post on tracking authors in WordPress with Google Analytics if you need clarification on the intended functionality. In the example script, you can see that I had to take the code that identifies and records the author, and modify it to use _gaqPush['_trackEvent'] instead of pageTracker._trackEvent(). You’ll also notice that the rest of the code is updated to the new async standards.

Downloads & Off-Site Links

Downloads and off-site links are typically tracked by using an onclick event to call pageTracker._trackPageview. Here is an example of how this has now changed.  The following HTML/JavaScript:

<a target=”_blank” href=”http://www.linkedin.com/in/adamware” onClick=”pageTracker._trackPageview(‘http://www.linkedin.com/in/adamware’);”>connect with me on LinkedIn</a>

Would need to be modified to:

<a target=”_blank” href=”http://www.linkedin.com/in/adamware” onClick=”_gaq.push(['_trackPageview', 'http://www.linkedin.com/in/adamware’]);”>connect with me on LinkedIn</a>

Notice again the the pageTracker code is ditched, and the attributes are now tucked into the gaqPush function with trackPageview.

Flash & AJAX

For requests made in Flash and AJAX, the change is essentially the same. Wrap any function calls (_trackPageview, _trackEvent, _setCustomVar) in the gaqPush function.

Events & Custom Variables

This is probably starting to sound like a broken record: take the existing function call and wrap it in the new gaqPush[] function. Here is an example of code that would be used to designate a visitor as registered using custom variables. It would have been:

trackPageview._setCustomVar(2, ‘RegisteredUser’, ’True’, 1);

but is now:

_gaq.push([‘_setCustomVar’, 2, ‘RegisteredUser’, ’True’, 1]);

Pretty basic modifications here.The important thing is just remembering where all the locations on your site are where you are using custom modifications. Most of our clients are at least using download tracking and off-site link tracking in some way, and many are using events and custom variables. The migration process won’t be immediate for some of them, but hopefully everyone will be using the async code within a couple months. I’d love to hear thoughts on any ways to make this process easier, and certainly on any details I may have left out.  Here is Google Analytics’ official Google Code page on migration.

Tags: , , ,

Tracking Authors in WordPress with Google Analytics Event Tracking

Here is a script for tracking authors in WordPress using Google Analytics Event Tracking. I threw this together in response to a blog post by Douglas Karr on tracking authors in WordPress. Doug presents a way to do this using spoofed pageviews and a separate profile. I could see a use case for that method also.

If you aren’t familiar with Doug’s blog, I highly recommend it. A great resource for digital marketers, with frequent posts on SEO, analytics, social media and a variety of other subjects.

Tags: ,

How to Create a Custom Advanced Segment in Google Analytics

I put this together for a SwellPath client the other day, so I thought I would share it here, since it is a bit too 101 for the SwellPath blog.

Overview of Advanced Segments in GA

Array

By default Google provides several advanced segments that you can use out-of-the-box. If you look into the upper right corner when you are viewing reports, you’ll see the Advanced Segments link and dropdown option. If you open it, you’ll see the option to check a variety of segments in the Default Segments section, ranging form Paid Search Traffic, to visits from iPhones. You can check up to 3 at a time, to evaluate next to the All Visits segment. If you want to compare 2 or more segments, All Visits can’t be unchecked. If you just want to view a single segment in isolation, you can uncheck the All Visits option. Play around with these a bit, and navigate the reporting with various segments checked. It will give you an idea of how this works, and some insight into how the data can be much different for certain segments.

Creating a Custom Segment

Once you’ve had some time to get accustomed to using advanced segments, you should walk through creating one. An easy “beginner” segment is one created to view only visitor in a specific geographic area. Let’s say North America. Here are the steps to create it.

1. Click the Advanced Segments dropdown, and look for the link on the left side that says “Create a new advanced segment”.

Array

2. The creation interface is drag-n-drop. You have the ability to choose between dimensions and metrics for segmentation. For this segment, you’ll go into Dimensions > Visitor and choose Sub-Continent Region, and drag it over to the creation interface. Choose “Matches exactly” for the condition, and then chose Northern America for the value.

3. Name your segment something appropriate like “North American Visitors” and click the Create Segment button. You should be taken back into the reporting.

4. Dropdown the Advanced Segments, check your new segment, it will be in the Custom Segments section. Then peruse your reporting and look at them metrics of your North American visitors compared to your visitors as a whole.

Viewing Custom Advanced Segment Data

Now viewing these segments might not be that meaningful to you; you might want to go create a segment for your European visitors and compare that to your North American visitors. But just follow these steps. As far as I know there isn’t a limit to the number of custom segments you can have, at least I haven’t hit that limit. Custom segments are now organized at the profile and user level, so you will only see your own segments in your account, and those segments will be profile specific. You can hide certain segments from profiles. You can share segments with other users by sending them a link; it is accessible from the custom segment management interface.

Tags: , , ,

Happy Holidays: from Google, but for Facebook

Array

Happy Holidays everyone. I just wanted to extend a quick holiday greeting.  I’m going to borrow the holiday greeting image from Google Analytics, because I like it so much. It is from Google Analytics’ Happy Holidays post to everyone.

Biggest takeaway from the 2009 holiday season? For me it is the fact that according to Hitwise, Facebook was the number one most visited site on the web on Christmas day. Phenomenal when you take into account the incident in Detroit, which presumably drove loads of traffic to Google and the major news sites.

Array

What does Facebook’s dominance mean? Well, nothing that we didn’t know already, but perhaps a slap in the face for some media providers, that rather than focusing on your own sites, maybe looking for creative ways to integrate into your audience member’s Facebook visits is where the focus should be.

Just some food for thought; I’d gladly write a longer post but we’re scrambling to finish up year-end activities at SwellPath before the first monthly reporting session of the new year hits. Enjoy the rest of 2009 everyone and best wishes for a wonderfully successful 2010.

Tags: , ,

Analytics App for iPhone – Mobile Google Analytics

Array

My first review of an iPhone application has to be Analytics App.  Just last week I was sitting in a meeting and a client was asking about historical analytics data.  I had only been engaged with the client for a short time, so I wasn’t sure about some conclusions they were drawing from the data.  We were at a location where wifi wasn’t available, so there was no way to access the data.  It was frustrating to say the least.  Had I access to Analytics App on the iPhone, I could have pulled up the client’s account and had access to the data within about 30 seconds.  This application is a must have for any analytics consultant with Google Analytics accounts to manage; if you’re a real analytics freak, it truly gives you reason alone to have an iPhone.

The interface itself is simple but highly effective.  You have access to all your accounts and profiles from the introscreen.  Switching between profiles that belong to multiple account is actually easier than it is in the GA interface.  Once you are in a profile you see a menu of options.  The first is Today which is really handy for just quickly checking in on account to get a read on traffic.  Below that are the rest of the reports you’re used to seeing in the Google Analytics interface.  You can navigate quickly between sections to see the data that’s important to you.

Array

Once you’re in a specific area, you can the basic data from those respective sections in Google Analytics.  If you want to modfiy the date range, this is another feature that is actually faster and easier in Analytics App then it is in the GA interface.  You have access to the same slot-machine-like date interface that is used in the iPhone calendar application.

Without a doubt, you’ll quickly get to a point where you want to dig deeper into the data, and you’ll be unable to in Analytics App.  However, the application isn’t for hardcore analysis, but rather for exactly what it does: offering you a very quick and easy way to monitor your basic analytics data from anywhere.

The one thing that would make this application way more effective is if GA had real-time data: but that is obviously in the hands of Google, and not Michael D. Jensen (@mdjensen) the creator of Analytics App.  Pulling in data from an application like Clicky or Woopra that has real-time data would be really cool.

Overall, pretty impressive and well worth the $5 it costs.  Thanks to Michael for creating such a great app.

Tags: , ,

wheresitworking? contains reviews, insights, reflections, and ideas about digital marketing, interactive media, web applications, and ecommerce. Written by Adam Ware, a journeyman web junkie in Portland, Oregon.
Sponsored by

Search

wheresitworking Tweets:

    Want more wheresitworking?