Google Analytics Admin: Node.js Client
Admin client for Node.js
A comprehensive list of changes in each version may be found in the CHANGELOG.
- Google Analytics Admin Node.js Client API Reference
- Google Analytics Admin Documentation
- github.com/googleapis/google-cloud-node/packages/google-analytics-admin
Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.
Table of contents:
Quickstart
Before you begin
- Select or create a Cloud Platform project.
- Enable the Google Analytics Admin API.
- Set up authentication with a service account so you can access the API from your local workstation.
Installing the client library
npm install @google-analytics/admin
Using the client library
// Imports the Google Analytics Admin API client library
const analyticsAdmin = require('@google-analytics/admin');
async function main() {
// Instantiates a client using default credentials.
// TODO(developer): uncomment and use the following line in order to
// manually set the path to the service account JSON file instead of
// using the value from the GOOGLE_APPLICATION_CREDENTIALS environment
// variable.
// const analyticsAdminClient = new analyticsAdmin.AnalyticsAdminServiceClient(
// {keyFilename: "your_key_json_file_path"});
const analyticsAdminClient = new analyticsAdmin.AnalyticsAdminServiceClient();
// Calls listAccounts() method of the Google Analytics Admin API and prints
// the response for each account.
const [accounts] = await analyticsAdminClient.listAccounts();
console.log('Accounts:');
accounts.forEach(account => {
console.log(account);
});
}
main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
Samples
Samples are in the samples/
directory. Each sample's README.md
has instructions for running its sample.
Sample | Source Code | Try it |
---|---|---|
Analytics_admin_service.acknowledge_user_data_collection | source code | |
Analytics_admin_service.approve_display_video360_advertiser_link_proposal | source code | |
Analytics_admin_service.archive_audience | source code | |
Analytics_admin_service.archive_custom_dimension | source code | |
Analytics_admin_service.archive_custom_metric | source code | |
Analytics_admin_service.audit_user_links | source code | |
Analytics_admin_service.batch_create_user_links | source code | |
Analytics_admin_service.batch_delete_user_links | source code | |
Analytics_admin_service.batch_get_user_links | source code | |
Analytics_admin_service.batch_update_user_links | source code | |
Analytics_admin_service.cancel_display_video360_advertiser_link_proposal | source code | |
Analytics_admin_service.create_audience | source code | |
Analytics_admin_service.create_conversion_event | source code | |
Analytics_admin_service.create_custom_dimension | source code | |
Analytics_admin_service.create_custom_metric | source code | |
Analytics_admin_service.create_data_stream | source code | |
Analytics_admin_service.create_display_video360_advertiser_link | source code | |
Analytics_admin_service.create_display_video360_advertiser_link_proposal | source code | |
Analytics_admin_service.create_firebase_link | source code | |
Analytics_admin_service.create_google_ads_link | source code | |
Analytics_admin_service.create_measurement_protocol_secret | source code | |
Analytics_admin_service.create_property | source code | |
Analytics_admin_service.create_search_ads360_link | source code | |
Analytics_admin_service.create_user_link | source code | |
Analytics_admin_service.create_web_data_stream | source code | |
Analytics_admin_service.delete_account | source code | |
Analytics_admin_service.delete_android_app_data_stream | source code | |
Analytics_admin_service.delete_conversion_event | source code | |
Analytics_admin_service.delete_data_stream | source code | |
Analytics_admin_service.delete_display_video360_advertiser_link | source code | |
Analytics_admin_service.delete_display_video360_advertiser_link_proposal | source code | |
Analytics_admin_service.delete_firebase_link | source code | |
Analytics_admin_service.delete_google_ads_link | source code | |
Analytics_admin_service.delete_ios_app_data_stream | source code | |
Analytics_admin_service.delete_measurement_protocol_secret | source code | |
Analytics_admin_service.delete_property | source code | |
Analytics_admin_service.delete_search_ads360_link | source code | |
Analytics_admin_service.delete_user_link | source code | |
Analytics_admin_service.delete_web_data_stream | source code | |
Analytics_admin_service.fetch_automated_ga4_configuration_opt_out | source code | |
Analytics_admin_service.get_account | source code | |
Analytics_admin_service.get_android_app_data_stream | source code | |
Analytics_admin_service.get_attribution_settings | source code | |
Analytics_admin_service.get_audience | source code | |
Analytics_admin_service.get_big_query_link | source code | |
Analytics_admin_service.get_conversion_event | source code | |
Analytics_admin_service.get_custom_dimension | source code | |
Analytics_admin_service.get_custom_metric | source code | |
Analytics_admin_service.get_data_retention_settings | source code | |
Analytics_admin_service.get_data_sharing_settings | source code | |
Analytics_admin_service.get_data_stream | source code | |
Analytics_admin_service.get_display_video360_advertiser_link | source code | |
Analytics_admin_service.get_display_video360_advertiser_link_proposal | source code | |
Analytics_admin_service.get_enhanced_measurement_settings | source code | |
Analytics_admin_service.get_global_site_tag | source code | |
Analytics_admin_service.get_google_signals_settings | source code | |
Analytics_admin_service.get_ios_app_data_stream | source code | |
Analytics_admin_service.get_measurement_protocol_secret | source code | |
Analytics_admin_service.get_property | source code | |
Analytics_admin_service.get_search_ads360_link | source code | |
Analytics_admin_service.get_user_link | source code | |
Analytics_admin_service.get_web_data_stream | source code | |
Analytics_admin_service.list_account_summaries | source code | |
Analytics_admin_service.list_accounts | source code | |
Analytics_admin_service.list_android_app_data_streams | source code | |
Analytics_admin_service.list_audiences | source code | |
Analytics_admin_service.list_big_query_links | source code | |
Analytics_admin_service.list_conversion_events | source code | |
Analytics_admin_service.list_custom_dimensions | source code | |
Analytics_admin_service.list_custom_metrics | source code | |
Analytics_admin_service.list_data_streams | source code | |
Analytics_admin_service.list_display_video360_advertiser_link_proposals | source code | |
Analytics_admin_service.list_display_video360_advertiser_links | source code | |
Analytics_admin_service.list_firebase_links | source code | |
Analytics_admin_service.list_google_ads_links | source code | |
Analytics_admin_service.list_ios_app_data_streams | source code | |
Analytics_admin_service.list_measurement_protocol_secrets | source code | |
Analytics_admin_service.list_properties | source code | |
Analytics_admin_service.list_search_ads360_links | source code | |
Analytics_admin_service.list_user_links | source code | |
Analytics_admin_service.list_web_data_streams | source code | |
Analytics_admin_service.provision_account_ticket | source code | |
Analytics_admin_service.run_access_report | source code | |
Analytics_admin_service.search_change_history_events | source code | |
Analytics_admin_service.set_automated_ga4_configuration_opt_out | source code | |
Analytics_admin_service.update_account | source code | |
Analytics_admin_service.update_android_app_data_stream | source code | |
Analytics_admin_service.update_attribution_settings | source code | |
Analytics_admin_service.update_audience | source code | |
Analytics_admin_service.update_custom_dimension | source code | |
Analytics_admin_service.update_custom_metric | source code | |
Analytics_admin_service.update_data_retention_settings | source code | |
Analytics_admin_service.update_data_stream | source code | |
Analytics_admin_service.update_display_video360_advertiser_link | source code | |
Analytics_admin_service.update_enhanced_measurement_settings | source code | |
Analytics_admin_service.update_google_ads_link | source code | |
Analytics_admin_service.update_google_signals_settings | source code | |
Analytics_admin_service.update_ios_app_data_stream | source code | |
Analytics_admin_service.update_measurement_protocol_secret | source code | |
Analytics_admin_service.update_property | source code | |
Analytics_admin_service.update_search_ads360_link | source code | |
Analytics_admin_service.update_user_link | source code | |
Analytics_admin_service.update_web_data_stream | source code | |
Analytics_admin_service.acknowledge_user_data_collection | source code | |
Analytics_admin_service.archive_custom_dimension | source code | |
Analytics_admin_service.archive_custom_metric | source code | |
Analytics_admin_service.create_conversion_event | source code | |
Analytics_admin_service.create_custom_dimension | source code | |
Analytics_admin_service.create_custom_metric | source code | |
Analytics_admin_service.create_data_stream | source code | |
Analytics_admin_service.create_firebase_link | source code | |
Analytics_admin_service.create_google_ads_link | source code | |
Analytics_admin_service.create_measurement_protocol_secret | source code | |
Analytics_admin_service.create_property | source code | |
Analytics_admin_service.delete_account | source code | |
Analytics_admin_service.delete_conversion_event | source code | |
Analytics_admin_service.delete_data_stream | source code | |
Analytics_admin_service.delete_firebase_link | source code | |
Analytics_admin_service.delete_google_ads_link | source code | |
Analytics_admin_service.delete_measurement_protocol_secret | source code | |
Analytics_admin_service.delete_property | source code | |
Analytics_admin_service.get_account | source code | |
Analytics_admin_service.get_conversion_event | source code | |
Analytics_admin_service.get_custom_dimension | source code | |
Analytics_admin_service.get_custom_metric | source code | |
Analytics_admin_service.get_data_retention_settings | source code | |
Analytics_admin_service.get_data_sharing_settings | source code | |
Analytics_admin_service.get_data_stream | source code | |
Analytics_admin_service.get_measurement_protocol_secret | source code | |
Analytics_admin_service.get_property | source code | |
Analytics_admin_service.list_account_summaries | source code | |
Analytics_admin_service.list_accounts | source code | |
Analytics_admin_service.list_conversion_events | source code | |
Analytics_admin_service.list_custom_dimensions | source code | |
Analytics_admin_service.list_custom_metrics | source code | |
Analytics_admin_service.list_data_streams | source code | |
Analytics_admin_service.list_firebase_links | source code | |
Analytics_admin_service.list_google_ads_links | source code | |
Analytics_admin_service.list_measurement_protocol_secrets | source code | |
Analytics_admin_service.list_properties | source code | |
Analytics_admin_service.provision_account_ticket | source code | |
Analytics_admin_service.search_change_history_events | source code | |
Analytics_admin_service.update_account | source code | |
Analytics_admin_service.update_custom_dimension | source code | |
Analytics_admin_service.update_custom_metric | source code | |
Analytics_admin_service.update_data_retention_settings | source code | |
Analytics_admin_service.update_data_stream | source code | |
Analytics_admin_service.update_google_ads_link | source code | |
Analytics_admin_service.update_measurement_protocol_secret | source code | |
Analytics_admin_service.update_property | source code | |
Quickstart | source code | |
Quickstart.test | source code |
The Google Analytics Admin Node.js Client API Reference documentation also contains samples.
Supported Node.js Versions
Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:
- Legacy versions are not tested in continuous integration.
- Some security patches and features cannot be backported.
- Dependencies cannot be kept up-to-date.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed through npm dist-tags.
The dist-tags follow the naming convention legacy-(version)
.
For example, npm install @google-analytics/admin@legacy-8
installs client libraries
for versions compatible with Node.js 8.
Versioning
This library follows Semantic Versioning.
This library is considered to be in preview. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time.
More Information: Google Cloud Platform Launch Stages
Contributing
Contributions welcome! See the Contributing Guide.
Please note that this README.md
, the samples/README.md
,
and a variety of configuration files in this repository (including .nycrc
and tsconfig.json
)
are generated from a central template. To edit one of these files, make an edit
to its templates in
directory.
License
Apache Version 2.0
See LICENSE