The Google Analytics API allows programmatic access to various data related objects, such as filters, segments, goals, experiments and custom dimensions and metrics.
Data management entities are all accessed in similar way, with the major differences between them being where in the Google Analytics hierarchy the entities belong.
Filters and profile filter links
Filters exist at the account level, but they only take affect on your data once you create a profile filter link. An account can have many filters and then selectively apply them to various levels. Both endpoints accept the full complement of REST verbs,
update. For additional resources see:
Segments are top level entities, they belong to the user, and can only be created within the Google Analytics web interface, but the management API allows you to list the authorized users' segments. This method is useful if you are creating an application with the Core Reporting API as the segmentsId property can be used with the 'segment' parameter in the Core Reporting API. For additional resources see:
Goals exist at the view (profile) level. Although they can be created and updated with the API they cannot be deleted, but they can be marked as inactive by setting the active property to
False. Also you can create at most 20 goals through the API; see the limits and quotas page for details. For additional resources see:
Custom dimensions and metrics
Custom dimensions and metrics can be created and updated via the API which is often useful when setting up a large number of properties. It should be noted that when you change the name or scope of an existing custom dimension or metric, your data can be affected which may lead to unexpected inconsistencies. To learn more see the Implementation Considerations section of the Custom Dimensions and Metrics help center article. For additional resources see:
- Custom Dimensions and Metrics in analytics.js
- Custom Dimensions and Metrics in Android SDK
- Custom Dimensions and Metrics in iOS SDK
- Custom dimensions & metrics
Now that you have an understanding of how to manage accounts, manage users and manage data resource, let's take a look at using some of Google Analytics more advanced configurations, the next sections cover Google Ads Linking, Data Import, and Unsampled Reporting (Analytics 360).