Search results

Google Analytics Source

Google Analytics is a service for web analytics that tracks and provides data regarding user engagement with your website or application.

Service Account Credential

Service account credentials are better suited for server-to-server interactions.

Grab Google Service Account Credentials

To get API credentials using a GCP service account, follow these steps:

  1. Sign in to
  2. Create a service account if needed.
  3. Enable “Google Analytics API” (refer to Google documentation for comprehensive instructions).
  4. Generate credentials:
    • Navigate to IAM & Admin in the console’s left panel, and then select Service Accounts.
    • Identify the service account you intend to use, and click on the three-dot menu under the “Actions” column next to it.
    • Create a new JSON key by selecting “Manage Keys” > “ADD KEY” > “CREATE”.
    • Download the “.json” file containing the necessary credentials for future use.

Share the Google Analytics Property with the API

Note: For service account authentication, use the client_email.

  1. Log into your Google Analytics account.
  2. Choose the website property you wish to share.
  3. In the lower-left corner, select the “Admin” tab.
  4. In the “Account” column, navigate to “Account Access Management.”
  5. Locate and click on the blue “+” icon in the top right corner of the screen.
  6. Choose “Add users” and input the email from the service account or OAuth authentication methods. Ensure to grant at least viewer privileges.
  7. Conclude the process by clicking “Add” in the top right corner.

Connection Properties

In a YAML file, the config section contains the following properties:

Connectorname: Google_analytics
project_id: ID of the project
client_email: Email of the client
private_key: Private key

Example Configuration

version: 1
encrypt_credentials: false
    - name: Google_analytics_data
      connectorname: Google Analytics
        project_id: <PROJECT ID>
        client_email: <CLIENT EMAIL>
        private_key: <PRIVATE KEY>
        property_id: <PROPERTY ID>
          - resource_name: sample_analytics_data1
            dimensions: ["browser", "city"]
            metrics: ["totalUsers", "transactions"]
          - resource_name: sample_analytics_data2
            dimensions: ["browser", "city", "dateHour"]
            metrics: ["totalUsers"]
        start_date: <START DATE>