Add to Google Add to Bloglines Add to Newsgator Add to Yahoo! Contact ROI Revolution Sign Up for the ROI Newsletter Unofficial Google Analytics Blog Feed Unofficial Google Analytics Blog
Unofficial Google Analytics Blog by ROI Revolution

Categories Search This Blog Blogroll Archive

| |

December 12, 2007

Default Page vs. Home Page

By Shawn Purtell, Google Analytics Support Tech

Crystal_Clear_app_kfm_home.pngYou've probably played around with the Default Page setting in Google Analytics. In many cases, this is definitely the way to go, as it will prevent your home page from showing up in different ways in your Google Analytics reports (as / and /index.html for example).

But you need to be careful when you set the default page, as it will not only affect your home page, but any page that ends with a forward slash ('/').

What do I mean by this? It's pretty simple - if you set the default page to index.html, it will not only change any future / entries into /index.html, but if you have another page ending in /, say /blog/, it will change that to /blog/index.html too. But what if your blog's default page is actually /blog/index.php? Well, then you have a problem.

If you have several such subdirectories or pages, then you have several problems. The good news is that there is a simple way to create a simple filter that only replaces the home page.

First, you should check and see if you need it - as in many cases simply setting the default page will work just fine. There are two ways to check:

1. If you have already set your default page in Google Analytics, go to your Top Content report. Enter in your default page name into the search bar at the bottom of the report and click Go. If you see any other entries here other than your home page, make sure they are actual pages on your site, and not things that were incorrectly changed by your filter (like the /blog/index.html example above). You can simply click on the 'View this Page' button next to the page name if you're not sure, and that should give you a good idea. If any of these are incorrect, you may want to use the filter below.

2. If you do not yet have your default page set, you still want to head over to the Top Content report. In the search field, enter in /$

This is a regular expression that will look for any pages that end in a forward slash. Take a good look at the list that appears and see if the default page should be the same for each one. If it is not the same, then you'll want to leave the default page blank, and use the filter below.

So let's get to the filter. It's a simple Search and Replace that looks for the blank slash and replaces it with your home page name. That's it.

Here it is:

home-page-filter-small.gif

This filter will only replace blank slashes. You need to make sure that you replace /index.html from the example here with whatever the real name of your home page is.

If you have other pages that require this kind of attention, you'll have to change the filter pattern as well. So, using the blog scenario from above, I could create another Search and Replace filter, use ^/blog/$ as the filter pattern and then /blog/index.php as the replacement.

UPDATED 12/14/2007

Originally, I had made the error of saying you could use the same Search and Replace Filter to achieve the above affect for multiple pages at once by simply changing the filter pattern. I'm not sure where my head was at when I wrote that, but it was decidedly not correct, and was pointed out below by Justin and David (thanks for catching this). To make up for that error, here's the Advanced Filter you would need to add a default page for multiple entires with a single filter.

The following Advanced Filter will look for entires that are /, /sub1/, and /sub2/, and append a default page name (index.html) to the end so they become /index.html, /sub1/index.html, and /sub2/index.html:

advanced-default-filter-sma.gif

Sorry about the error, but hopefully this correct Advanced Filter makes up for it. Thanks again to those who commented on this for keeping me on my toes!

END OF UPDATE

So feel free to be creative, and keep that data clean!

Please leave a comment if you have any questions about these filters, or why you might want to think about using them. Thanks for reading!


Find The Secret To Solid, Sustainable Improvements To Your Website
Learn the insider secrets to making more money from your website than ever before – Guaranteed! Get started right away with the Google Analytics Training Course.

Posted by Shawn Purtell at 12:43 PM









Filed under: , ,

TrackBack

TrackBack URL for this entry:
/mt/mt-tb.cgi/270.

Comments

Hey Shawn,

Great post. I think there may be an issue with your search and replace filter. If memory serves me right, the search and replace filter will replace the entire filter field. So, in the example you give, the entire Request URI will be replace with /index.html regardless of which pattern is matched. So if the Request URI is /sub1/ that entire value will be replaced with /index.html not /sub1/index.html.

I'm pretty sure that's the way search & replace filters work... but Google may have changed them on us. Gotta love those unannounced changes!

I believe the correct solution is to use an advanced filter to capture the appropriate part of the request URI and combine it with the appropriate default page name.

Let me know if I'm way off on this one...

Justin

Posted by: Justin at December 13, 2007 11:37 AM

Can you provide an example of the "multi-replace" filter?

Wouldn't

^/$|^/sub1/$|^/sub2/$

replace

/, /sub1/, and /sub2/

with just /index.html?

How are the sub-folders preserved when doing the replacement?

Posted by: David Burke at December 14, 2007 12:34 AM

Justin,

No, you're right about this one. I think I was in too much of a hurry to publish and got some of my mental wires crossed. Thanks for catching this. Although the original home page filter in the post is correct, I'm updating the post to contain the Advanced Filter you would need to use to replace multiple pages at once.

Thanks for reading.

Posted by: Shawn Purtell, Google Analytics Support Tech Author Profile Page at December 14, 2007 9:22 AM

@David:

Good catch. I'm updating the post to contain the Advanced Filter you would need to accomplish the task. Thanks for pointing this out.

Posted by: Shawn Purtell, Google Analytics Support Tech Author Profile Page at December 14, 2007 9:24 AM

Hi Shawn,
Thanks for the update! This is great information.

One other situation comes to mind, but would require using .* as part of a regular expression. From what I've read, Google suggests avoiding the use of .* as it "may slow down processing the expression."


The sitation is this: I've got a "regular site" with a WordPress blog installed. Anywhere from the blog parent folder on down a URL ending in / would map to /index.php So /blog/sub1/, /blog/sub1/sub2/, /blog/sub1/sub2/sub3/ would all need "index.php" appended.


Can the Advanced filter be set up like:

Field A -> Extract A  Request URI  ^/blog.*/$

Output to Constructor  Request URI  $A1index.php

Or is using .* in the regular expression going to cause problems?

Posted by: David Burke at December 14, 2007 7:12 PM

@David:

Glad you found the new information useful. Sorry for screwing it up the first time.

Anyway, to answer your question, you were close. You just need to put parentheses around the whole thing, so that it will be stored in the variable $A1, like this:

(^/blog.*/$)

Everything else looks fine. I don't think adding the .* is going to cause problems in this case.

Posted by: Shawn Purtell, Google Analytics Support Tech Author Profile Page at December 17, 2007 2:22 PM

Can we add GA code in .info sites??????

Posted by: alder at December 31, 2007 7:52 AM

@alder:

I don't see why not, although I haven't personally set up Google Analytics on a .info site. As long as the user's machine can process the Google Analytics javascript code on the site, there should be no problem.

Posted by: Shawn Purtell, Google Analytics Support Tech Author Profile Page at January 2, 2008 9:31 AM

Post Your Comments

Post a comment

Contacting ROI Revolution

Telephone Number:
(919) 954.5955 ext. 306
ask for Meredith Smith

Office Fax:
(919) 954.4767

Address:
3109 Poplarwood Ct.
Suite 219
Raleigh, NC 27604


Authorized Google Analytics Consultant

Google Analytics Certified Service and Support Consultant


Free Webinar!

Join a Live FREE Google Analytics Training Webinar
Register now to learn how to
turn Google Analytics into
pure profit! You'll learn how to use many of the key reports, a ten-step system for properly configuring Google Analytics on your website, and how to apply what you learn to the attainment of your online goals. Register for our free Google Analytics training webinar today.


Subscribe to the
ROI Revolution Google
Analytics Newsletter today

Free monthly email publication that contains valuable, practical tips, secrets, and much more! Subscribe to our free Google Analytics newsletter today.


Looking to Purchase
Urchin 5 Software or Fee
Based Support?

We are a Urchin software certified service and support partner! Buy Urchin 5 software, profile packs, load balancing modules, campaign tracking, or fee-based support today.