I was teaching a class on Google Analytics last week. The audience was non-technical and the session focused on how to effectively use GA reports and the most efficient way to communicate data to clients. While browsing the Content Optimization reports one of the antendees made a great observation. She commented that viewing ‘hits’ based on page name is not very useful, especially for dynamic sites that use many query string variables to drive content. A fantastic observation! Is this Content Summary report easy to interprit?
Right now you’re probably thinking, well, just use the Page Titles reports. That’s a great idea, but there are so many reports in GA that use the page name and query string variables to show page hits. I started to think, is there some way to force Google Analytics to use the page title in all the content reports?
The answer is yes. We can create a filter that modifes how the page names appear in all GA reports. To do this we apply an advanced filter to the profile. The goal is to replace the page name (such as index.asp?PageAction=VIEWCATS&id=234) with something that is more readable, like the page title (i.e. Product Category: Cameras).
Here are the filter settings:
Filter Name: | Replace Page Names with Titles | |
Filter Type: | Custom Filter | Advanced |
Field A -> Extract A: | Page Title | (.*) |
Field B -> Extract B: | – | – |
Output To -> Constructor | Request URI | $A1 |
Filed A Required: | Yes | |
Field B Required: | No | |
Override Output Field: | Yes |
Just apply this filter to your profile. There are some drawbacks to this approach.
- If the page titles are not set up correctly on the website then this configuration will not work. Multiple pages with the same title will alter the data.
- If you generate ‘virtual’ page hits using urchinTracker() I don’t think this approach will work.
- This filter will break the site overlay report. If you need to use site overlay then it is best to implement this filter on a duplicate profile.
In general, this filter seems to be stable. I have noticed some discrepency in the number of total hits, but it has been low (approximately a 10% descrepency in the data). As usual, I reccomend creating a test profile to observe how the reports change based on this filter. If all goes well then you can add the filter to your production profile.
I stumbled upon your blog looking for some help with google filters. Your post is close to what I (think) I need to do, did, but the result was not what I expected. My question is: I have content that falls under a certain path in the URL (e.g. http://mysite.com/path1/page1.html .. page2.html, etc) How can I create a filter that would lump all those pages together and report them as one entry?
I would greatly appreciate your help.
thanks.
Hi Kal,
Great question. To lump all of these pages you want to use an advanced filter. The filter will ‘look’ at the URL for the page, patch a particular pattern and then replace the entire URL with some string that you enter. Here are the settings:
Filter Type: Custom : Advanced
Field A -> Extract A: Request URI : /my-directory/
Field B -> Extract B: – : –
Output To: Constructor: Request URI : my-replacement-string
Field A Required: Yes
Field B Required: No
Override Output Field: Yes
Case Sensitive: No
Hope that helps,
Justin
Thanks Justin. I’ve been away for few days. I’ll try your suggestion and report the result. thanks again.
It worked. Thanks Justin.
Hi everybody, your filter for the page title was exactly what I was looking for. However, I could not create it since the is a extra field called “Constructor” that is required. What that field is supposed to have? “Requested URL”?
And how is the filter works. Immediately? Only for new stats?
Thanks!
Hi Etienne,
Thanks for catching my mistake! I forgot to add the constructor to my post. I have updated the filter settings above.
The filter does not work immediately. It is only applied to data that is processed by Google Analytics in the future.
Thanks for reading my blog and thanks for catching my mistake!
Justin
A suggestion: While I did understand the concept, it would be much easier to grasp it if you could update the post by adding another screenshot of what the reports look like after the filter is applied.
Thanks to you, I am now trying more advanced filters but have a doubt about one of them and would appreciate your help. I’d like to display the page titles in the reports in this form – [User Defined Variable].Page Title
Field A -> Extract A: Page Title (.*)
Field B -> Extract B: User Defined (.*)
Output To -> Constructor Request URI [$B1].$A1
Filed A Required: Yes
Field B Required: Yes
Override Output Field: Yes
Should the ‘dot’ in the constructor be escaped ([$B1]\.$A1)?
(Again, thanks for sharing such a useful tip.)
Hi Sam,
Thanks for the tip! I’ll add a screen shot to the post.
Regarding your question, no. You do not need to escape the period in the Output To field.
Glad you’re trying new more advanced filters, they’re a wonderful way of making GA more usable.
Justin
It didn’t work. Like you mentioned, perhaps it’s because of urchinTracker() set to track ‘virtual pages’. I think we can overcome that by setting ‘Field A Required’ to ‘No’. (The help doc isn’t very clear on this – “The Field x Required option allows you to decide what to do if one of the expressions does not match.” which I assume means that if there is no match, the field won’t be included in the output constructor).
The really irritating part is waiting for 12+ hours to see if the filter works. Do you have any workaround for that?
Sorry Sam, there is no workaround for GA’s data processing. I agree that it is a pain to wait to see if a filter works. But, you gotta love the power and functionality that GA provides. And the price is pretty good too :)
Hello Justin,
I am anxious to try the filter you describe in this post, although I do plan to use urchinTracker() to track ‘virtual pages’ on this particular website. I was wondering if you can tell me if the filter won’t work with the urchinTracker data (as in the URLs will not be replaced by titles) or are you saying that the filter will prevent the urchintracker data from being collected at all? What if I use this filter on one profile to make the reports more readable, but have a separate profile that does not apply the filter to get the urchinTracker() data. Will urchinTracker() work in that profile that does not apply the filter even if there is a profile using the filter in the same GA account?
Thanks for the great post! It is very helpful.
Jaimie Scott
Hi Jamie,
The filter will work with data generated by urchintracker(), but the results are a bit off.
When you use urchinTracker() to generate data the value for the Page Title will be the value that appears on the page. So, if you have 5 calls to urchinTracker() on a single page, then all five will have the same Page Title value.
I suggest creating a separate profile and apply the page title filter to that profile. This way you can use the page titles profile for reference as the data may be a different.
Thanks for reading,
Justin
Thank for the filter. I’m curious if there is a way to omit a specified section of the title names. For example, if all of my pages are titled “Sitename – Titlename”… is there a way to exclude “Sitename -” from appearing before every true title in Analytics?
Hey Billy,
You can use an advanced filer to ‘rebuild’ the value of Page Title. Use a regular expression the capture the part of the title that you want, and then write them out to the Page Title field.
Hope that helps,
Justin
Hi!, your filter for the page title was exactly what I was looking for.thank you for sharing,we are now using it and it works.it is really a big help.but i have problem,we have a site called http://www.globalpropertyguide.com.its a real estate property guide of all countries.Each country page has 11 main menus.You can check the site if you want.
My problem is there a way to set a filter to display which
country pages has more traffic? or maybe list of top country pages according to its country.I hope you get my point,because i know in analytics,it only display the top page or content that has most number of visits.i want it in order of according to its country page name.
hope you can help us..thank you again for the great post..
christian
Hi Christian,
If your country pages all have distinct URLs then yes, you can create a filter based on the URL structure. My guess is that there is a query string parameter or a sub directory that identifies each country. Create a filter based on that, and then the data in your Top Content report will be specifically for that country.
Hope that helps,
Justin
thanks it works.
Hello,
I m trying to edit a filter in order to exclude all item (URL) which contain a string like /_layouts/
I have tried a lot and didnt’work !
Filter Type : Exlcude Pattern
Filter Field : request_uri(AUTO)
Filter Pattern : */_layouts/*
I schould be grateful if someone can help me.
In advance thank your for your help
I m looking forward to hering from you.
Fred.
Hi Christian,
Try changing your filter pattern to:
/_layouts/
That should fix the problem.
Thanks for reading.
Justin
Thank you for this blog and the help you have provided. I have looked all over for help with Advanced Reports, but haven’t found adequate help, so I apologize for abusing this blog and using it as a helpdesk.
I am new to GA and am trying to implement it in my Oracle Application Express applications. The URLs of pages of my applications are dynamic and fit a generic pattern. I need to apply a particular advanced filter to the URLs to remove parameters in the URL. I am also not familiar with regular expressions, so I’m lost due to that as well.
I do not wish to presume that you will fix my problem. Do you know anyone who has attempted to implement GA into Oracle’s Application Express tool? I would be happy to provide more details if you are interested yourself. Thanx.
Hi Shane,
Thanks for your comment and no need to appologize. it sounds like you have a simple issue, to eliminate unneeded query string parameters. This is fairly easy in GA. Check out this post about removing the parameters. Also check out this post about making GA data quality suck less.
Thanks for the comment and thanks for reading.
Good luck,
Justin
Hi Justin,
arriving late in the game to this discussion – I hope you can help! I have one site on 20 directories, one per language. I have some pages with duplicate URIs, eg ‘/hu/’ and ‘/hu/index.aspx’.
I still want to report the separate languages – so keeping the directories the same –
Can i create a filter to replace the blanks with ‘index.aspx’ without creating 20 search and replace filters? How would you go about it?
Best,
Phil
@Phil: That’s a good idea. You could try to use an advanced filter to do it. Could be tricky, but try something like this:
Filed A: Request URI
Extract A: ^(/[a-z][a-z]/)$
Field B: blank
Extract B: blank
Output to: Request URI
Constructor: $A1index.html
Field A Required: Yes
That should work, but I would TEST IT ON A TEST PROFILE! Just to make sure :)
Hope that helps,
Justin
Excellent post and subsequent replies, Just what I was after – thanks alot everyone!