The post “Pittfalls of Tracking to Multiple Accounts in GA” has been updated to have some Async examples.
Let us know what other posts you’d like to see updated.
Each time a page is viewed on a website with GA implemented, one of the pieces of information that is passed back to Google is the domain of the site on which the page was viewed.
This seems pretty straight foward.
If visitors view http://lunametrics.com/index.html the hostname is lunametrics.com
If visitors view http://lunametrics.com/training.html the hostname is lunametrics.com
If visitors view http://lunametrics.com/blog.html the hostname is lunametrics.com
If visitors view http://lunametrics.com/sexytimes.html the hostname is lunametrics.com
See a pattern?
So a report that lists all the traffic to the lunametrics.com site should be pretty damn boring.
We might expect it to look something like this:
And that would be the end of this post.
Except that, in fact though, our hostnames report looks like this:
Okay, so let’s take a quick look at some of these other hostnames.
This one is easy. When Google crawls websites, they also save the pages in their own cache. This is people who have viewed our LunaMetrics webpages from that cache instead of at LunaMetrics.
Also easy. People who view our website through Google’s translate service. Looks like we may have a few readers who don’t want to, or aren’t able to, read the english version.
Bonus Tip (from Jonathan Weber): If you look at the pages from translate.googleusercontent.com (using an Advanced Segment, for example), you can see which pages people translated, and the URLs also include a query parameter that tells you which language the page was translated into.
Not sure, maybe the cached pages sometimes come up as google.com instead of googleusercontent.com? Something I’ll have to look into because now I’m curious.
This is a website hosting service. Did someone post a copy of one of our webpages here? Maybe someone at LunaMetrics was playing with their service? I don’t know.
Our IP address, instead of ‘lunametrics.com’
A press release service that hosts your press release. Going here shows one of our Training pages. Maybe someone here was trying out their service?
If you use Google Checkout, part of the process happens on checkout.google.com. There’s an integration with GA that lets you measure visits to those pages directly to your GA account, allowing you to set up a complete funnel for your checkout goal. This hostname is due to those pages.
Our web-mail service. Maybe someone emailed themselves one of our webpages?
This is a proxy service. Looks like someone didn’t want their boss to know they were checking out our site!!
This is a Yahoo.com IP address. Maybe used for Yahoo’s page caching.
Bing’s page caching domain.
This is a Website Testing tool. Looks like someone here uploaded some of our website content to optimizely to test out their service?
Usually, lunametrics.com gets re-written to www.lunametrics.com. Looks like there is at least one case where it doesn’t get re-written correctly.
Besides seeing your domain without any prefix, you may also see your own subdomains listed here, such as blog.lunametrics.com or store.lunametrics.com. This is a great guide to what subdomains you should doublecheck tracking for to make sure you have the same GA code on each subdomain.
Another webpage caching service.
Another proxy service like hidemyass.com
Well, that’s it. That’s the hostnames report and some of the information you can get from it.
With GA you can track custom information about a visitor, a specific visit, or a particular page with Custom Variables.
One of the things people often want to do is to know when the visit is a signed-in visit.
pageTracker._setCustomVar(1,”Signed-in status”, “Signed-in”, 2);
_gaq.push(["_setCustomVar", 1, "Signed-in status", "Signed-in", 2]);
(Here is the GA documentation for _setCustomVar and information on how to set a Custom Variable.)
For example, here are 2 screenshots of the aboutus.org website. The first is the signed-in version. The second is the signed-out version.
Once you’ve set the custom variable for your signed-in visits, you can then look at that segment of visits and see how they stack up. Are they more likely to click on ads? Sign up for your newsletter? Purchase a product? Of course, you can get these insights by going to the Visitors > Custom Variables report in your GA, or by creating a Custom Report to pull in just the information you want to see for that segment.
If your site’s search results page uses a query parameter to denote what the visitor searched for, setting up site search in GA is pretty straight forward:
But in GA there is no “path” option:
What to do?
If we pass the _trackPageview() method a parameter, it will use that value as the URL for the page, INSTEAD of whatever happens to be in the browser’s address bar.
This might look like:
Where “keyword” is replaced (by YOU) with the actual keyword that each particular visitor searched for.
This replacement can be done in several ways.
1. CMS script – your CMS system may have a template scripting language that allows you to reference the keyword value.
This might look like:
var s = location.pathname;
var re = new RegExp(“/search/([^/]*)/?$”);
var m = s.match(re);
pageTracker._trackPageview(‘/search/?q=’ + m);
*Assuming the results page is in the format http://www.mysite.com/search/keyword
3. Server side scripting language such as asp, php, cold fusion, etc.
This might look like:
pageTracker._trackPageview(‘/searchresults/?q=<?php echo $keyword ?>’);
*Assuming you have a php variable named “keyword” that contains the search terms used. Don’t just insert this example code into your site and expect it to work — this is to demonstrate the concept only
So the technical details of how you programatically get the keyword into the string of text that you pass to _trackPageview(. . .) will differ from case to case. But the ideas above should get your web developer started in the right direction.
Sometimes when presenting a report to someone else, you may want to display a list of pages as Page Titles instead of URLs. But you still want to filter the list to show only certain pages. And you want to filter the list to only show pages based on the URL. In this screenshot, I am displaying a report by URL and as the Secondary Dimension I have selected Page Title. The filter at the bottom of the report works on the First Column and I have filtered the report to a particular subdirectory.
So far this looks pretty straight forward, right?
The catch is, in GA, there is no option to select Page Title as a Secondary Dimension in the URL report.
This means that if you want to display the pages by Page Title for only a sub-directory, you’d have to come up with a very convoluted filter to filter in every page title in that subdirectory and at the same time remove unwanted positive matches from other sub-directories.
So how did I get URL and Page Title to show up in the same report?
The trick is in using a URL parameter called “segkey” which you add to the URL in the address bar for the report. For reference, I’ve included the report URL below (Note that I xxx’d out the ID for the profile):
Step 1: Generate your Top Content Report
Step 2: Copy and Paste &segkey=request_uri|page_title into the url in the query parameter section of the URL (amidst the other & parameters)
Step 3: Press enter and enjoy your report.
Other reasons to do this
There are a couple of reasons, from an SEO perspective, that you may want to show both the page URI and page title together.
1. Find duplicate title tags – If you’re looking at a specific section of your site, like in the example above, you can quickly see how targeted your title tags are. You might even find duplicate title tags. In the example above, you can see we have two pages with the same title tag – #4 and #8. Each page on your site should have a different title tag, and this gives you the opportunity to be more specific and target more long-tail search terms.
2. Monitor & Measure – If you’ve changed the title tag on a page, you can filter to contain just the URI for that page, then show a month before and a month after the change to see if traffic to that page has increased or decreased.
Thanks to Jim for the “Other reasons to do this” section, and thanks to Christina for helping me to rewrite parts of the post.
In the right sidebar of our blog is a form that can be used to submit questions.
Mostly it is just used to spam us, but we do occasionally get a legitimate question or two:
Question 1 concerned exporting more rows. The official GA blog posted an article on this topic not long ago. The trick is to use a query parameter in the URL:
Question 2 was about image files showing up in Top Content reports when they shouldn’t.
Normally an image file would not appear at all in your Top Content reports, unless you add special implementation. I’m not sure how to answer this question without actually looking at the case in question, but one thing you might check, if you feel the item in question is no longer on your site is to create an Advanced Segment for visits that include that item. Then check the hostnames report and see if the visits are occurring on your domain. It might be that the views for that item is being sent to GA from a cached or copied version of an old page on another domain.
Question 3 involved configuration of automatic emails in GA.
Above the graph in most reports is a grey bar. On the left hand side of the bar is a button that is labeled “email”. Go to the report you wish to email and click that button. After clicking on that button you are taken to a screen where emails can be set up. Click on the tab that is labeled “Schedule” and select the recipients, the delivery schedule, etc. When the options are set up as you prefer, click the “schedule” button at the bottom of the form.
What is a Funnel?
Your goal funnel is the set of required pages leading up to your final goal, such as a purchase. You may be familiar with the Funnel Visualization report in Google Analytics (GA). It shows you how many visitors go to each step and how many leave the funnel at that step. You can spot trouble points with your funnel and take steps to correct the issue. Here’s what the report looks like:
While you can segment goal metrics such as goal completions, starts and values in GA, you can’t segment the Funnel Visualization report. You can’t see how different types of visitors may leave the funnel at different steps. For example, you may just want to see where new visitors abandon your goal funnel, compared to returning visitors. When you look up at Advanced Segments in the top right of the Funnel Visualization report, here’s what you see:
The Horizontal, Segmentable Funnel
I want to show you a method that will allow you to see your goal conversion funnels in any report, segmented however you want. I’m going to name it the “Horizontal Funnel” since we’ll be viewing it left to right, instead of top to bottom.
Let’s start with what you’ll get, using this method.
The traditional GA Goal Funnel report shows
- Number of visits to each step in the funnel
- The percentage of visits that continued to the next step
- Where exiting visits went.
With the Horizontal Funnel method you’ll see
- Number of visits to each step in the funnel.
- The percentage of visits that did not continue to the next step
You don’t get to see where exiting visitors went. . .but you WILL be able to:
- Apply Advanced Segments
- See the funnel for multiple segments in the same report
Let’s look at an example of what a traditional e-commerce funnel that looks like:
Shopping Cart –> Address Info –> Payment Info –> Review Order –> Thank You
In the image below, the values outlined in blue are the visits to each step, and the values outlined in orange are the exit rate between steps.
It’s like a regular funnel, just flipped on it’s side, using goals, first steps in funnels, and custom reports – more detail below. As you can see, this is in a keyword report. So, the funnel can be seen in-line in the report, for whatever segments you want; in this case for individual keyword phrases. And you can apply Advanced Segments or Secondary Dimensions to the report.
That’s the “what”. Now for the “how”.
1. Create the Goals
For each step in the funnel, we create a separate goal in GA. This provides the values in blue: how many visits touched each step. Now we want to be able to get the values in orange, the exit rate between steps. In each of the goals following the first step in the conversion process, we create a funnel. Each funnel contains a single step which is the Goal URL for the preceding goal. That’s the key. The preceding goal becomes the Funnel Step 1 URL for the next goal.
2. Create the custom report
Now that the goals are set up we can create the custom report we need to view the data. To set up the report we are going to use two different metrics, Goal Completions and Abandonment Rate.
The Goal Completion metric is the number of visits in which a particular Goal URL was visited at least once.
The Abandonment Rate metric is the percentage of visits that started the funnel (saw Step 1), but did not complete the goal.
In our Goal #17, we made the Funnel Step 1 = Goal #16 Completion. So, Goal #17 Abandonment Rate = percentage of visits that saw Goal#16 but did not complete Goal #17 = Exit Rate between the 2 goals. In this example the first step in the funnel is in Goal Slot #16, so Goal 16 Completions goes first. The second step was in Goal Slot #17, so we place Goal 17 Abandonment Ratenext, followed by Goal 17 Completions.
Then Goal 18 Abandonment Rate, followed by Goal 18 Completions.
And so on.
After you have all the goals in place in the Metrics section of the report, it’s time to move on to the Dimensions. In this case, we chose to dimension by Keyword. But you may wish to see your goal funnel report by City, State, Browser, Landing Page, or whatever is most appropriate for your situation.
That’s it. Happy Funnel Segmentation.
As Ophir Prusak helpfully pointed out in the comments section, it would be a good idea to note that the values you get using this method may be a little different from what the Funnel Visualization report shows.
One of the reasons for this is that the Funnel Visualization report makes the assumption that If a visit includes Step 3, for example, then it MUST include Step 2 and Step 1.
So if an actual visit sees Step 3, But DOESN’T see Step 2 or Step 1 — what does GA do? It adds a count to Step 1 and Step 2 ANYWAY.
This Horizontal Funnel method does not do this. So if you have a funnel with entrances into the middle of the funnel, numbers may be different.
There are probably other good reasons why they could be different as well, but that is the most obvious one and definitely needed to be pointed out.
For more about tricky funnel issues in GA try checking out this post on our blog: Funnel Problems in Google Analytics
It sometimes happens that someone will accidentally use your GA Web Property ID (UA-xxxxx-y) in their website.
When this happens, pageviews and visits from their website will show up in your GA reports.
To prevent this, you can create a filter and apply it to your main profiles.
The screenshot shows the use of a Custom -> Include filter on the Hostname field. This example is for the site cats.com.
We are only including pageviews that happen on a domain that matches the regular expression “cats.com”. This will match all of your subdomains such as my.cats.com or pictures.cats.com.
Website spanning multiple domains:
If you have a website that spans multiple domains such as cats.com and mycats.com and bluecats.com, then instead of filtering on “cats.com” you simply list all your domains, separated by a pipe:
If you have a profile that doesn’t have any filters on it, for raw data and troubleshooting, make sure you don’t add this filter to that profile.
(Update: We have an automatic cross domain tracking script for the asynchronous version of Google Analytics. Check it out!)
Whenever a visitor crosses from one domain to another, the information contained in the cookies must be passed in the query string to the second domain. Google Analytics documentation recommends using the provided method of _link(). This looks like:
<a href=”http://www.newsite.com” onclick=”pageTracker._link(‘http://www.newsite.com’);return false;”>Go to our sister site</a>
Following this link will cause the visitor to arrive on the page http://www.newsite.com/?__utmb=. . . .&__utmv=. . . .&_utmk=123456789&__utma=1.1234567.1234567. . .&utmz=. . .
With the values of those query parameters used by the GA code on the new site to create the necessary tracking cookies.
But when you have a very large number of links that cross from one domain to the other, it is difficult to find and modify every one, and to continue to maintain and update new links as they are created in the site.
There are several examples of scripts like this, and sometimes the script will need to be modified slightly to suit a particular web site or particular needs.
iQ Content published an autotracking script in this blog post:
An example of a script that I used for a particular client:
You can also find script examples in the books:
* Advanced Web Metrics by Brian Clifton (http://www.advanced-web-metrics.com/blog/about-the-book/)
* GA Short Cuts by Justin Cutroni (http://gashortcut.com/)
If you have an example of an automatic tracking script for GA you’d like to share, link to it in the comments below.
A website test can often involve a lot of people, IT staff, Designers, Content Owners, etc. While the technicals are fairly straight-forward, the process involved to get everyone working together can be really hard. And people *will* make mistakes.
Are you going to wait to make those mistakes while everyone is focused on you for that massive Home Page test that you just barely got approval to run after months of trying ??
Why not make those mistakes before anyone cares?
Start with a test page. Have your designer create alternate content for it, your IT staff put in the code, etc. This gives you an opportunity to talk to everyone about what you’re doing and where you’re going and why it is in their best interest to get the kinks worked out beforehand. It’s not a real page on the site so if the code is put in wrong, it’s no big deal — noone cares.
Move on to an actual page on the website that is not important to anyone. This is a slightly bigger deal than the test page, but if you screw it up, noone will probably notice. Just test something minor that noone will notice. Decide on a conversion page and look at real data. Try presenting the results.
This practice is beneficial to everyone involved, so that when the real test comes around, you’ve already made your mistakes, and hopefully, worked them out. Remember that the point of the practice is to work out the process and make sure everyone looks good when it is time to do the real first test.