Skip to content

Latest commit

 

History

History
40 lines (35 loc) · 1.74 KB

File metadata and controls

40 lines (35 loc) · 1.74 KB

Google Analytics Admin API examples

Open in Cloud Shell

These samples show how to use the Google Analytics Admin API from .NET.

Build and Run

  1. Enable APIs - Enable the Analytics Admin API and create a new project or select an existing project.

  2. Download The Credentials - Configure your project using [Application Default Credentials][adc]. Click "Go to credentials" after enabling the APIs. Click "Create Credentials" and select "Service Account Credentials" and download the credentials file. Then set the path to this file to the environment variable GOOGLE_APPLICATION_CREDENTIALS:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
  3. Clone the repo and cd into this directory.

    git clone https://github.com/googleanalytics/dotnet-docs-samples
    cd dotnet-docs-samples/analytics-data
  4. Confirm that dotnet is installed.

    dotnet --version
  5. Review the comments starting with TODO(developer) and update the code to use correct values.

  6. Build the solution.

    dotnet build AnalyticsAdmin.sln
  7. Run the executable produced by the build step. For example:

    ./QuickStart/bin/Debug/net6.0/QuickStart