What is a viewId in Google Analytics?

John D. picture John D. · Apr 27, 2016 · Viewed 33.7k times · Source

According to the Google Analytics "Creating a Report" guide, a required field for a request is the viewId:

A valid view ID for the viewId field.

Cool. So what is a viewId and where do I find it? I click on the viewId link and it says:

Unique View Id for retrieving Analytics data.

Umm. Ok. But what is it, and how do I find it for the report I want? It doesn't appear to be the same as "property ID". Come on Google, we need a little more to work with here.

Answer

Eike Pierstorff picture Eike Pierstorff · Apr 27, 2016

A property is where the data is collected (so hits to a property count toward your hit quota for that account). A view is where you look at the data, it displayed hits from the property. Hits displayed in view do not count towards your quota.

Use cases are that you can include/exclude/change the data in views by filters, and set different permissions for views (e.g. different departments should have access only to tracking for certain sub-directories, stuff like that). You can create up to 25 views with different settings per property.

You find the view id when you go to the admin section and look at the outer right column (which is labelled "views"). Select the view you want to query from the dropdown and go to "view settings", there you find the id. Or visit the query explorer while you are logged in to Google and select the view from the dropdown, this will also show the view id (and you can start testing queries right away).