Thursday, November 19, 2009

How to effectively use Google Analytics for multiple Web sites

Want to analyze the traffic and trends on your Web site? Most of the time people have a single Web site and a single Google Analytics (GA) account to get the job done. This is pretty straight forward and everything works as planned.

What do you do if you have multiple Web sites with separate URLs?

One conclusion would be to create a separate GA account for each site and copy/paste the code into each Web site's footer. If you only care about analytics for each site individually then this is a perfectly acceptable solution. What if you want to aggregate the analytics or see how people move between sites? Well then that solution quickly breaks down as it is littered with problems.

The best method to handle analytic reporting is to use a single GA account and code snippet. Why? Because you can look at all the Web site traffic separately (as normal), aggregate data from multiple or all Web sites, create custom reports and segments (fields with user-defined criteria) and do it all without having to manage multiple accounts.

Sounds great doesn't it? It works well, but it requires a number of steps to set up and considerations when working with the data. Follow the steps below and you'll be on your way to viewing complete analytic data for two, three or even hundreds of your Web sites. Steps 1-3 will just be review for most people.

Step 1: Create Site(s)
Create/manage one or more Web sites (If this is not done, then you need to read another blog)

Step 2: Create Account
Create a Google.com account and Log into Google Analytics.

Step 3: Add Code
Create or use an existing profile and copy/paste the tracking code into all of your Web site's footers. This is more than one step, but this blog assumes you have already grasped the general concept of using Google Analyics.

There are few variables that you need to set in the tracking code for your specific needs. Follow the links below that best describes your URL structure.
Once you have the correct pageTracker._setDomainName variable set on your code publish it to your Web sites.

Step 4: Create Filters
This is the most important step because it allows you to separate out the traffic from site to site. If you do not create filters all of the traffic from all of the different Web sites will be aggregated. For example if you have these two about page: www.acme.com/about and www.example.com/about Google Analytics will by default reports both sites together as "/about". Google assumes you are using the code on a single Web sites so you need to take extra steps to make a single account and tracking code work on multiple sites.

A a minimum you will need to create a domain filter like the following:



What this filter does is takes the hostname of the Web site and appends the Request URI variable and sets it back to the Request URI variable. This same method will work for domains and subdomains.

Removing www from URL
(optional)

If you are not 301 redirecting all of your traffic to a single URL then I am going to recommend one more filter. For example if www.acme.com and acme.com are both valid URLs you will want to combine these into a single domain to effectively use Google Analytics. Below is an example filter of how to do it, but if you can use a 301 redirector at the server level then skip this additional filter.



The details of this filter is that it uses regular expressions to filter out any URLs starting with www and takes the remaining URL string and sets it back to the hostname. The actual RegEx search string is "^(www\.)?(.+)$", which is used for both field A&B.

Please note that once you create a filter you need to make sure it is add to your specific profile. You can add filters to profiles by editing the profile. You can change the order of any of your filters, but please make sure the domain filter created is last in the list.

Step 5: Wait...
Since GA is not real-time you may have to wait hours to even a day before checking to see if analytics are being pulled in correctly. If you already have waited a day or so to have enough data you can move on to the next step.

Step 6: Creating Reports
Now that you are using a single GA account and tracking code, all of your statistics is automatically aggregated on the dashboard and other reports. There are two main ways to filter your data down to a specific hostname - first by drill down and second by creating an advanced segment.

Drill Down

You can simply drill down to a specific hostname (acme.com or acme.example.com) using the following steps to find the page view information.
  1. Click Content on the left menu
  2. Click Content Drilldown
  3. Click the hostname of the Web site in question or use the search box at the bottom of the list.
You are now viewing the specific page view statistics for this domain. You can continue to drill into directories of the Web site and at any point you can change the dimension drop down box from "page" so a specific piece of data you would like to view.

Example:



If you want to see visitors instead of page views you can follow this same method, but instead go to Visitors > Network Properties > Hostnames and use the same method to filter down to the Web site in question.

While drilling down is fairly easy it can get old very quickly and you are limiting yourself to all the rest of the analytic report.

So what is the better approach? Advanced segments!

Creating Advanced Segments

Advanced segments is a feature that made users do backflips when it was announced. It was the missing link and has truly made GA very much more powerful yet flexible tool. An advanced segment is simple way to filter the aggregated data down to any criteria. A simple boolean logic form is used to create any kind of filter based on any dimension or metric.

How does this help? You can simple create an advanced segment for each of your Web sites' hostnames and at will narrow down all of the reports to that site. You can view Google's brief video overview of advance segments for more information.

Follow the steps below to create your advanced segment.
  1. Click Advanced Segments from the left menu
  2. Click Create new custom segment on the top right
  3. Type in "hostname" in the filter box on the left menu of all available dimensions and metrics.
  4. Click and drag the green hostname box on the left into the center column dashed line box that says "dimension or metric".
  5. Keep the drop down window saying "matches exactly" unless you want your advanced segment to filter down to a substring of the hostname.
  6. In the text box to the right type in the hostname without any http://.
  7. Give the segment a title like "Acme.com Traffic".
  8. Click the "test segment" button and make sure it gives you back some data so that you know this segment will return results.
Be aware if you've created a www filter, that you need to put in the hostname as it would be without the www. If you are keeping the www you can ignore this note. For example, if your Web site is www.acme.com and you redirect or filter out the www and send traffic to acme.com you will need to make sure you have that in your advanced segment.

Your advanced segment for each domain should look something like this:



Applying an advanced segment


Now that you have created an advanced segment for each of your Web site's hostnames you can apply them to the dashboard or when viewing any GA report.

Simply click the drop down menu near "advanced segments" on the top right of any report and you will see two menus. The left menu is all of the default segments that are available at which "all visits" is checked by default. The right menu is the list of each of your advanced segments that you created.

Please note that you can only check up to 3 segments at a time for comparisons. Also, if you check more than one segment it automatically checks the "all visits" segment, which cannot be unchecked. If you want only a specific hostname, check the advanced segment on the right menu and then un-check the "all visits" from the left menu.

When you apply a custom advanced segment it should look something like this:



Just click apply once you've made your selections and wait a few moments for the advanced segment to be applied. This segment will stay active until you make another selection or if you click the back arrow to a page that previously didn't have the current selected segment checked.

That's it! Seems like a lot of steps, but most people should be able to go through them quickly and it is pretty intuitive after you've done it a few times.

Be aware that any advanced segment you create is only associated with your Google account. If you have given out read access to the reports those people will not see your segments and will have to create their own using the same steps.

Google still says the advanced segments are still in beta, but the trends and traffic levels are very similar to reports manually generated from log files directly from the server.

If you have any questions or comments, please let me know!

0 comments:

Post a Comment