Google Analytics: Setting up Profile Filters
To define what data appears in your Google Analytics reports and how it is displayed, filters process raw request data and pass it to the appropriate profile. Raw data cannot be re-processed once it has been passed through a filter, so it is recommended to maintain a completely unfiltered profile in addition to the rest as a safety/backup.
2 types: pre-defined & custom filters.
Edit a profile, click add Filter, then choose whether to edit or create a new filter.
Commonly used pre-defined filters:
- Exclude all traffic from a domain (Google Analytics does a reverse lookup on a visitor's IP address to determine whether they're coming from a domain that you wish to filter). Domains mostly refer to your ISP, but larger companies often have their IPs mapped to their domain name.
- Exclude all traffic from an IP address. Can specify exact IP or range of IPs.
- Include only traffic to a subdirectory. Usually used to track visits to a certain section of the site only.
Custom filters allow greater contol over what data appears in your profiles.
- filter types
- filter field (eg. request URI, visitor country)
- filter pattern (actual text string that's used to match PV data -- use POSIX regexp)
Filter types: Exclude, Include, Lowercase/Uppercase (use to consolidate entries with differences in case), Search & Replace (often used to replace long URI string with something easier to read), Advanced (can be used to remove unnecessary data, replace one field with another, or combine elements from multiple filter fields, eg. use to track multiple subdomains in single profile: append the subdomain to the page names)
Profiles & filters can be used to customize the data view for different Google Analytics users. Eg. Filters to include only a certain subdomain, customers from a certain country, or AdWords visitors only.
When multiple filters are applied to a single profile, they will be executed in the same order that they are listed in the profile view. ie. the output from one filter is used as the input for the next. Multiple filters are boolean ANDed, not ORed. To 'OR' multiple values, use a single filter that has a regexp that accepts the alternative values, A|B.
If each subdomain is a separate business and there's no need to track cumulative data, simple create a unique profile for each subdomain. To do this, add the UA-XXXXX-1 tracking code to one subdomain, and UA-XXXXX-2 version to the other subdomain.
But to enable aggregation of traffic across multiple subdomains, create 3 duplicate profiles (ie. with the same tracking code). Use the first profile to report on all traffic, add an include filter for subdomainA to the second profile, and an include filter for subdomainB to the third filter.
Using Filters with AdWords traffic
To setup a filter to include only AdWords traffic, setup a profile with 2 filters: Campaign Source = google, and Campaign Medium = cpc
If you use your AdWords account for multiple sites, you'll need a custom include filter to capture click data for the site of interest only. Otherwise the Clicks tab in the AdWords report will include data from the whole AdWords account. To do this, select Filter Field "Campaign Target URL" and Filter Pattern yourdomain\.com.