Creating and Applying Filters


You can apply filters to profiles to help narrow the area of analysis to specific areas of your Web site, include otherwise excluded matching clicks, or make dynamic URLs more meaningful in Analytics reports. In the Analytics Setting section, find the subsection labeled Filters Applied to Profile. Click the + Add Filter link along the top bar of this section to get started.

In the Add Filter to Profile page, begin by selecting whether to apply a new filter or an existing filter to your profile by selecting one of the option buttons.

Follow these steps to begin creating a new filter:

  1. Select Add New Filter for Profile.

  2. Type a meaningful name for your filter in the Filter Name box. Create a name that explains your filter and remember that you can use it later to filter other profiles.

  3. Select the type of filter you want to create. These are the Filter type choices:

    • Exclude all traffic from a domain

    • Exclude all traffic from an IP address

    • Include only traffic to a subdirectory

    • Custom filter

  1. Specify a domain name as a regular expression. Regular expressions are phrases containing special characters that build matches. Matches are simply when two separate phrases somehow match each other. The special characters included in a regular expression are called wild cards.

    Wild cards are named for the special cards like the Joker in playing-card games. When you say, “Deuces are wild.” you are saying that all the 2 cards can represent any card you want them to represent. For example, *.JPG represents all filenames ending in .jpg. The * is a wild card used to represent all possibilities. So, myfile*.JPG is a regular expression that matches when filenames begin with myfile, followed by all possibilities, and ends with .JPG. There are several other characters used by Analytics to build regular expressions. They are explained in Table 36.1.

    Table 36.1: Wild Cards for Regular Filter Expressions
    Open table as spreadsheet

    Character

    Description

    .

    Match to any other single character

    *

    Match to zero or more of the previous items

    +

    Match to one or more of the previous items

    ?

    Match to zero or one of the previous items

    ()

    Designate contents of parentheses as an item

    []

    Match to an item in this list

    -

    Creates a range in a list

    |

    Logical OR match if this matches OR that matches

    &

    Logical AND match only if this matches AND that matches

    ^

    Anchor character - match all to the beginning

    $

    Anchor character - match all to the end

    /

    Escape character used to include literal character such as the . (dot) in a domain name

Note 

It has been said that, “Regular expressions are a means by which IT people confuse non-IT people.”

An important character you must know about when building filters is the escape character - the forward slash. You must use the escape character / to specify periods (“dots”) in a domain name, or IP address. For example, www/.mydomain/.com or 192/.168/.120/.151. You must use the escape character to identify the literal period because the dot has a special meaning in regular expressions. It means “match any other single character.”

The domain name or IP address you type in this form represents the domain from which you want data included or excluded. Remember to use the escape character to escape periods. This is required.

Entire books have been written about building regular expressions. It takes some work to become comfortable creating these expressions. Be patient and experiment creating your filter expressions. One of the common filter expressions you may want to create is one that filters out all the hits from your own domain. Hits from your own domain may not accurately represent true traffic patterns to your site or may include testing data.

For more information about regular expressions, you can read the Wikipedia page at http://en.wikipedia.org/wiki/Regular_expressions.

Creating include and exclude filters

Include and exclude filters are used to focus your report by excluding unwanted user visits to your site, or hits, from your report. The names of the filters, include and exclude, are a little confusing because both are used to narrow the number of hits in a report by excluding data from the report, but how they work to accomplish this is different.

When patterns match in an exclude filter, the hit is ignored (not included in the report). An include filter tells Google which hits to keep. Patterns that match are included in the report and those not matching are ignored. You can’t mix and match expression types. You either use exclude filters or include filters.

You can create exclude filters using a single expression with multiple pattern matches, or you can create several exclude expressions. When several patterns are used in a single expression, they are grouped together using the logical OR, found in Table 36.1. Only one of the patterns in the expression needs to match in an exclude filter expression for the hit to be excluded.

Building include filters works the same way, creating a single expression with multiple pattern matches or creating several include expressions. This is where the similarity stops. Unlike exclude expressions, all the patterns in an include expression must match to be included. Otherwise, the hit is ignored.

Building search and replace filters

Search and replace filters are used to replace information gathered by Analytics, such as part numbers or meaningless directory names, with text that will be meaningful in a report. For example, if you run an e-commerce site and you track part numbers, replace part number x123 with Barber Chair, black.

Using advanced filters

Analytics allows you to combine fields of information into a single field so that they are more informative. You can do this using advanced filters. Advanced filters put two or more fields, or parts of fields, together using constructor expressions. Constructor expressions are regular expressions that take information from two extracted fields and create a single field.



Google Power Tools Bible
Google Power Tools Bible
ISBN: 0470097124
EAN: 2147483647
Year: 2004
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net