Do you need to copy view filters between Google Analytics accounts?
Google Analytics provides a practical framework for managing view filters within one Google Analytics account, but not for copying filters between Google Analytics accounts. Examples of filters that your organization might use in multiple Google Analytics accounts include:
- Internal IP address filters, especially one with complex regular expressions
- Lowercase filters for URLs, events and campaign parameters
- Filter for adding Hostname to Request URI to clarify the All Pages report in the case of a cross-domain, multiple subdomains, or rollup implementation
We can think of two methods to copy filters:
- Open two browser windows, create filters in the new Google Analytics account and manually paste text as needed from each legacy filter to the new filter. This sounds cumbersome and prone to errors.
- Use the Google Analytics Management API by either writing a script, finding an already written one online or using the API Explorer. This sounds time-consuming and also prone to errors.
Recently, E-Nor discovered a Google Sheets add-on called GA Management Magic (developed by our friend Pedro Avila at Google) that is much easier to manage, more pleasant to use and less prone to errors than either of the two typical methods.
GA Management Magic lets you:
- Download all filters for a Google Analytics account to a Google Sheet
- Change the filters in the Google Sheet, if desired
- Upload the filters to another Google Analytics account
You can’t assign filters to views with GA Management Magic, but that is easy to do in the Google Analytics Admin UI.
Google Sheets output from GA Management Magic
You can download filters, then edit filter definitions, remove filters you don’t want and add new filters. Then you can upload them to another GA account.
Auditing Filters with GA Management Magic
Another use for GA Management Magic would be to audit filters. Sometimes, a GA account can contain filters that are outdated or no longer needed, or filters that perform the same function. Identifying these in the Google Analytics UI is difficult. In Google Sheets, you can sort rows making it easier to identify filters that need to go! It’s much easier to keep a clean list of filters current than it is to work with a messy set of filters.
We did discover that GA Management Magic will update a limited number of filters at one time. Our tests indicate that the limit is between 5 and 100, so keep this in mind. If you need more clarity on that, E-Nor recommends contacting the add-on author at GA Management Magic
GA Management Magic also lets you configure custom dimensions and custom metrics, i.e. what you do in property admin in the GA UI to allocate the custom dimension or metric slots before we start collecting actual custom dimension or metric data.
Analytics Management API
The Google Analytics Management API is typically used for bulk analytics configurations. However, using the API Explorer in Google’s Analytics Management API can be a quick way to download and possibly — depending on what you want to do — make changes to your organization’s GA account. It seems that the API method, Profile Filter Links: list, in the screenshot below is probably used by the GA Management Magic add-on.
Source: Management API > Profile Filter Links > List
The API Explorer returns results in JSON format. It’ll be easier to work with downloaded results if you convert JSON to CSV using one of the many converters available online, and import that CSV to Excel or Google Sheets.
E-Nor wishes you much happy view filtering!