What is a viewId in Google Analytics?
Following below steps to get View ID.
- Sign in to Google Analytics.
- Click Admin, and navigate to View.
- In the VIEW column, click View Settings.
- View ID places in Basic Settings
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).
This document describes the Google Analytics account structure, and should answer your question as to what a view is: https://support.google.com/analytics/answer/1009618
If you're even unsure of what ID to use with a particular GA API, you can use the account explorer to find out: https://ga-dev-tools.appspot.com/account-explorer/