{"data":{"slug":"github-google-skills-skills-analytics-google-analytics-admin-api-basics-c4ccf2b630ca","title":"Manage Google Analytics Accounts and Properties","summary":"Programmatically configure Google Analytics accounts, properties, data streams, and integrations using the Admin API.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-analytics-google-analytics-admin-api-basics-c4ccf2b630ca","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-analytics-google-analytics-admin-api-basics-c4ccf2b630ca","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-analytics-google-analytics-admin-api-basics-c4ccf2b630ca.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-analytics-google-analytics-admin-api-basics-c4ccf2b630ca\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"To use this skill, ensure the Google Analytics Admin API is enabled via the Cloud CLI and install the Google Analytics Admin client library using pip.","instructions":"---\nname: google-analytics-admin-api-basics\nmetadata:\n  version: \"1.0.0\"\n  category: GoogleAnalytics\ndescription: >-\n  Manages Google Analytics account and property settings, enables the Analytics Admin API via the Cloud CLI, lists accounts and properties, and manages data streams, custom dimensions, conversion events, and integrations. Use when you need to programmatically configure Google Analytics accounts, provision properties, manage data retention, configure Measurement Protocol secrets, or manage Firebase and Google Ads links.\n---\n\n# Getting Started with Google Analytics Admin API\n\nThe Google Analytics Admin API provides programmatic access to Google Analytics\naccount and property configuration. It lets you automate account management,\nmanage data streams, configure custom dimensions, and handle product\nintegrations.\n\n## Enabling the API via Cloud CLI\n\nBefore making API calls, ensure the Google Analytics Admin API is enabled in\nyour Google Cloud project.\n\nIf `gcloud` is not found, prompt the user to install the Google Cloud CLI before\nrunning these commands.\n\n1.  **Enable the API:** Use the Cloud CLI (`gcloud`) to enable\n    `analyticsadmin.googleapis.com`.\n\n    ```bash\n    gcloud services enable analyticsadmin.googleapis.com --quiet\n    ```\n\n    *Why: Enabling the API ensures your Cloud project has the necessary quota\n    and permissions allocated for managing Google Analytics configurations.*\n\n2.  **Verify API Enablement:**\n\n    ```bash\n    gcloud services list --enabled --filter=\"analyticsadmin.googleapis.com\"\n    ```\n\n## Authentication\n\nTo authenticate your API requests, you must generate Application Default\nCredentials (ADC) and give your account the necessary scopes. Run the following\ncommand in your terminal:\n\n```bash\ngcloud auth application-default login --scopes=\"https:\/\/www.googleapis.com\/auth\/cloud-platform,https:\/\/www.googleapis.com\/auth\/analytics.readonly\"\n```\n\n*Why: This configures ADC in your local environment with the required Cloud\nPlatform and Google Analytics read-only scopes, allowing the client library to\nautomatically authenticate your requests.*\n\n> [!NOTE] **Configuration Changes**: Methods changing the Google Analytics\n> account\/property configuration will need the\n> `https:\/\/www.googleapis.com\/auth\/analytics.edit` scope.\n\n## Admin API Use Cases\n\nYou can use the Google Analytics Admin API to:\n\n*   Run Data Access reports (see\n    https:\/\/developers.google.com\/analytics\/devguides\/config\/admin\/v1\/access-api.md.txt\n    for more info)\n*   Create Account summaries\n*   Manage accounts\n*   Provision new accounts\n*   Search account change history events\n*   Manage and create properties\n*   Manage property data retention settings\n*   Manage conversion events\n*   Manage custom dimensions and metrics\n*   Manage data streams and configure measurement protocol secrets\n*   Manage Firebase links\n*   Manage Google Ads links\n*   Manage key events\n\n### v1alpha-Only Use Cases\n\nThe following capabilities are currently available only in the `v1alpha` version\nof the Admin API:\n\n*   Manage account and property access bindings\n*   Create and manage rollup properties\n*   Create and manage subproperties\n*   Acknowledge user data collection\n*   Change property attribution, data retention, Google signals, reporting\n    identity, and User Provided Data settings\n*   Manage AdSense links\n*   Manage BigQuery links\n*   Manage audiences\n*   Manage channel groups\n*   Manage calculated metrics\n*   Manage DisplayVideo360Advertiser links\n*   Manage expanded data sets\n*   Manage reporting data annotations\n*   Manage SearchAds360 links\n*   Manage event create rules for a data stream\n*   Manage SKAdNetwork conversion value schema of an iOS stream\n*   Submit a request for user deletion for a Google Analytics property.\n\n## Calling the Admin API\n\nTo interact with the Admin API, use the official Google Analytics Admin client\nlibrary. Note that `v1beta` is the most stable version of the Admin API. For the\nlatest features, consider using `v1alpha`.\n\n> [!IMPORTANT] **Mandatory Agent Directive:** When the user selects or requires\n> a specific programming language, read the corresponding client library setup\n> reference guide in `references\/` listed below.\n\n### Supported Client Libraries\n\n#### Python\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor Python, read the setup guide:\n\n*   [Python Installation Reference](references\/python.md) *(Package:\n    `google-analytics-admin`)*\n\n#### Java\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor Java, read the setup guide:\n\n*   [Java Installation Reference](references\/java.md) *(Artifact:\n    `com.google.cloud:google-cloud-analytics-admin`)*\n\n#### PHP\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor PHP, read the setup guide:\n\n*   [PHP Installation Reference](references\/php.md) *(Package:\n    `google\/analytics-admin`)*\n\n#### Node.js\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor Node.js, read the setup guide:\n\n*   [Node.js Installation Reference](references\/nodejs.md) *(Package:\n    `@google-analytics\/admin`)*\n\n#### Go\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor Go, read the setup guide:\n\n*   [Go Installation Reference](references\/go.md) *(Package:\n    `cloud.google.com\/go\/analytics\/admin\/apiv1beta`)*\n\n#### .NET\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor .NET \/ C#, read the setup guide:\n\n*   [.NET Installation Reference](references\/dotnet.md) *(Package:\n    `Google.Analytics.Admin.V1Beta`)*\n\n#### Ruby\n\nIf you need to install or set up the Google Analytics Admin API client library\nfor Ruby, read the setup guide:\n\n*   [Ruby Installation Reference](references\/ruby.md) *(Gem:\n    `google-analytics-admin-v1alpha`)*\n\n> [!NOTE] **Additional Resources**: For further examples of calling the Admin\n> API with Java, PHP, Node.js, .NET, Python, and REST, as well as hints on\n> authentication with a service account, refer to the official\n> [Admin API Quickstart](https:\/\/developers.google.com\/analytics\/devguides\/config\/admin\/v1\/quickstart).\n> For complete API reference documentation for both `v1alpha` and `v1beta`, see\n> the\n> [Admin API Reference](https:\/\/developers.google.com\/analytics\/devguides\/config\/admin\/v1\/rest).\n\n### Python Quick Start\n\n1.  **Install the Client Library:**\n\n    ```bash\n    pip install google-analytics-admin\n    ```\n\n    If `pip` is not available, prompt the user to install `pip` before\n    installing the client library.\n\n2.  **List Accounts and Properties:** Below is a complete example demonstrating\n    how to call the Admin API to list all available accounts and their child\n    properties for the current user using `list_account_summaries()`.\n\n    ```python\n    from google.analytics.admin import AnalyticsAdminServiceClient\n\n    def sample_list_account_summaries():\n        # Initialize the client.\n        # Assumes Application Default Credentials (ADC) are configured in your environment.\n        client = AnalyticsAdminServiceClient()\n\n        # list_account_summaries returns a summary of all accounts accessible to the\n        # user and their child properties.\n        account_summaries = client.list_account_summaries()\n\n        print(\"Available Google Analytics Accounts and Properties:\")\n        for summary in account_summaries:\n            print(f\"Account: {summary.display_name} ({summary.account})\")\n            for property_summary in summary.property_summaries:\n                print(f\"  Property: {property_summary.display_name} ({property_summary.property})\")\n\n    if __name__ == \"__main__\":\n        sample_list_account_summaries()\n    ```\n","use_cases":["Provision new Google Analytics accounts","Manage data streams and measurement protocol secrets","Configure Firebase and Google Ads links","Manage data retention and custom dimensions","Run Data Access reports"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/analytics\/google-analytics-admin-api-basics\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-16T06:57:31.000000Z","updated_at":"2026-11-16T10:49:37.000000Z","seo_title":"Manage Google Analytics Accounts and Properties","seo_description":"Use the Google Analytics Admin API to configure accounts, properties, data streams, and integrations programmatically.","seo_keywords":["Google Analytics Admin API","Manage Google Analytics accounts","Configure Google Analytics properties","Data streams management","Google Analytics integration"]}}