npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@google-analytics/admin

v7.6.0

Published

Admin client for Node.js

Downloads

19,445

Readme

Google Analytics Admin: Node.js Client

release level npm version

Admin client for Node.js

A comprehensive list of changes in each version may be found in the CHANGELOG.

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

  1. [Select or create a Cloud Platform project][projects].
  2. [Enable the Google Analytics Admin API][enable_api].
  3. [Set up authentication with a service account][auth] 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 | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.approve_display_video360_advertiser_link_proposal | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.archive_audience | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.archive_custom_dimension | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.archive_custom_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.audit_user_links | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_create_access_bindings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_create_user_links | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_delete_access_bindings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_delete_user_links | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_get_access_bindings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_get_user_links | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_update_access_bindings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.batch_update_user_links | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.cancel_display_video360_advertiser_link_proposal | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_access_binding | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_ad_sense_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_audience | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_big_query_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_calculated_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_channel_group | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_connected_site_tag | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_conversion_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_custom_dimension | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_custom_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_display_video360_advertiser_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_display_video360_advertiser_link_proposal | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_event_create_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_event_edit_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_expanded_data_set | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_firebase_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_google_ads_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_key_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_measurement_protocol_secret | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_property | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_rollup_property | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_rollup_property_source_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_s_k_ad_network_conversion_value_schema | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_search_ads360_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_subproperty | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_subproperty_event_filter | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_user_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.create_web_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_access_binding | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_account | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_ad_sense_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_android_app_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_big_query_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_calculated_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_channel_group | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_connected_site_tag | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_conversion_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_display_video360_advertiser_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_display_video360_advertiser_link_proposal | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_event_create_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_event_edit_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_expanded_data_set | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_firebase_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_google_ads_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_ios_app_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_key_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_measurement_protocol_secret | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_property | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_rollup_property_source_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_s_k_ad_network_conversion_value_schema | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_search_ads360_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_subproperty_event_filter | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_user_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.delete_web_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.fetch_automated_ga4_configuration_opt_out | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.fetch_connected_ga4_property | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_access_binding | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_account | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_ad_sense_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_android_app_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_attribution_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_audience | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_big_query_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_calculated_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_channel_group | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_conversion_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_custom_dimension | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_custom_metric | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_data_redaction_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_data_retention_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_data_sharing_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_display_video360_advertiser_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_display_video360_advertiser_link_proposal | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_enhanced_measurement_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_event_create_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_event_edit_rule | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_expanded_data_set | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_global_site_tag | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_google_signals_settings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_ios_app_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_key_event | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_measurement_protocol_secret | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_property | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_rollup_property_source_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_s_k_ad_network_conversion_value_schema | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_search_ads360_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_subproperty_event_filter | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_user_link | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.get_web_data_stream | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.list_access_bindings | source code | ![Open in Cloud Shell][shell_img] | | Analytics_admin_service.list_account_summaries | [source code](https://github.com/googleapis/google-cloud-node/blo