The Google Analytics Pro connector contains a Save Filter function that lets you copy view filters from one account to a number of others with ease.
Driven almost entirely by spreadsheet values, the function takes filter definitions from one worksheet locations and saves them to Google Analytics accounts/views defined in another worksheet location. Even the login account used for the command can be obtained from the workbook. Let’s look at a typical exercise: copying a pair of spam filters to multiple web properties.
Setup: Getting Permission
Before you can use the Save Filter function, you need a login account that has the necessary permissions. When you login through the Accounts wizard, it gets a security token for your account, but your account needs to have permission to actually save a filter (Edit at the Account level).
We need the filter definitions for the filters we want to save, and we can get these from existing filters in one of our accounts. Using the Management Lists – Filters function, we can dump a full list of filters in our account to a worksheet.
From the list, we can delete the rows we don’t want and keep just the filters we want — in this case, Spam Crawlers and Spam Crawlers 2. You can change any of the parameters manually, possibly updating this as a ‘Master List’, but do not change the column titles.
If you want to create a new filter, you can simply create one in one of your accounts and save it to a worksheet like we did here, then copy the row to the list (aligning the columns, in case they are different).
The other information we need is the list of Accounts and Views that we want to copy the filters into. Note that with Google Analytics, View filters are stored at the Account level and linked to a View. Even if you create the filter in the View, it actually adds it to the Account and links it to that View for you. That makes it possible to use the same filter on other Views in the same Account.
The easiest way to get this list is to dump an Account Summary using the Management Lists function. As above, delete the rows you don’t want to save the filter into and keep the ones you want.
Just remember, do not change the column titles.
Saving the Filters
This final step is the easiest. Open the Save Filter wizard, select or enter the location of the filter definitions, select the login account to use, and select or enter the location of the target accounts and views. The buttons to the right of the entry boxes allow you to pick the location of the data right in Excel — select the top-left cell of the table of data.
Note the three options at the bottom:
Overwrite existing filter in Account – this options looks for a filter with the same name in the target Account, and if found, overwrite the filter definition with a new one. If the filter has not yet been linked to the selected View, a new link is created. This options is useful when you want the same filter everywhere.
Overwrite existing filter in View – this option looks for a filter with the same name in the target Account AND a link to the selected View. If you are saving to multiple Views in the same Account, this option will create a unique copy of the filter (with the same name) in the target Account with a link to a specific View. This option is useful when you might want different filters in some Views.
Do not overwrite existing filter – this option creates a new filter in the Account and links it to the View for each entry. This option is useful when adding a filter and do not want to mistakenly overwrite a previous filter that just happens to have the same name.
Understanding the Results
The response from the function is a bit cryptic, but here’s what it means:
0,Spam Crawlers,EXCLUDE,xxxxxxx,UA-xxxxxxx-1,76111500,17566011,Existing filter OK,New view link 0,Spam Crawlers,EXCLUDE,xxxxxxx,UA-xxxxxxx-1,76063423,17566011,Existing filter OK,Existing view link OK 0,Spam Crawlers,EXCLUDE,xxxxxxx,UA-xxxxxxx-1,96933237,,FAILED copy to account !Error: 403 User does not have sufficient permissions for this account.,
For each filter to be copied, there is a row for each target Account-View showing the status of the save operation. The contents of each row is a number, the filter name, the filter type. the account, property and view ids, and a couple of status messages as below:
New filter id ###### – a new filter was created in the target account.
Updated Filter – the existing filter in the target account was updated.
Existing Filter OK – the filter already existed and did not need to be updated.
New view link – a new link was created between the filter and the target view.
Existing view link OK – the target view was already linked to the filter.
FAILED copy to account !Error:… – and error occurred trying to copy the filter into the target account. Usually this is a permission error caused by using a login that does not have the necessary access to the target account.