Skip to content

Google Analytics

The Google Analytics component lets you pull data from your Google Analytics account directly into Nappai.
You can choose between two types of reports – Account Report and Property Report – and specify dates, dimensions, metrics, and other options to shape the data you receive.

How it Works

When you add this component to a workflow, it connects to the Google Analytics API using a credential you set up in Nappai’s Credentials section.
The component sends a request that includes the operation you selected (Account Report or Property Report) and the parameters you provide.
Google Analytics processes the request and returns a structured dataset. The component then outputs this data as a Data object that can be used by other components, and it also creates a Tool that can be called by an agent if you want the component to act as an AI tool.

Operations

This component offers two operations that you can select based on what you need to do. You can only use one operation at a time:

  • Account Report: Generates a report that summarizes information about your Google Analytics accounts, such as account names and IDs.
  • Property Report: Generates a report that provides details about individual properties within an account, such as property names and IDs.

To use the component, first select the operation you need in the Operation field.

Inputs

Mapping Mode

This component has a special mode called Mapping Mode. When you enable this mode using the toggle switch, an additional input called Mapping Data is activated, and each input field offers you three different ways to provide data:

  • Fixed: You type the value directly into the field.
  • Mapped: You connect the output of another component to use its result as the value.
  • Javascript: You write Javascript code to dynamically calculate the value.

This flexibility allows you to create more dynamic and connected workflows.

Input Fields

The following fields are available to configure this component. Each field may be visible in different operations:

  • Operation: Choose which report you want to generate.

    • Visible in: Account Report, Property Report
  • Account Name: Select the Google Analytics account you want to query.

    • Visible in: Account Report, Property Report
  • Date Range End: The last date for the report.

    • Visible in: Account Report, Property Report
    • Format: YYYY-MM-DD
    • Requirement: Must be greater than Date Range Start
  • Date Range Star: The first date for the report.

    • Visible in: Account Report, Property Report
    • Format: YYYY-MM-DD
    • Requirement: Must be less than Date Range End
  • Dimensions: Choose the dimensions you want to include in the report.

    • Visible in: Account Report, Property Report
    • Available dimensions:
      • accessDateHour – Access Hour – All Google Analytics properties
      • accessMechanism – Access Mechanism – Google Analytics 360 properties
      • accessedPropertyId – Accessed Property ID – All Google Analytics properties
      • accessedPropertyName – Accessed Property Name – All Google Analytics properties
      • accessorAppName – Accessor App Name – All Google Analytics properties
      • costDataReturned – Cost Data Returned – Google Analytics 360 properties
      • dataApiQuotaCategory – Data API Quota Category – All Google Analytics properties
      • epochTimeMicros – Epoch Time in Microseconds – Google Analytics 360 properties
      • mostRecentAccessEpochTimeMicros – Most Recent Access Epoch Time in Microseconds – Google Analytics 360 properties
      • reportType – Report Type – Google Analytics 360 properties
      • revenueDataReturned – Revenue Data Returned – Google Analytics 360 properties
      • userCountry – User Country – Google Analytics 360 properties
      • userCountryId – User Country ID – Google Analytics 360 properties
      • userEmail – User Email – All Google Analytics properties
      • userIP – User IP – Google Analytics 360 properties
  • Last Operation: The last operation used for your Google Analytics.

    • Visible in: Account Report, Property Report
  • Last Url: The last URL used for your Google Analytics.

    • Visible in: Account Report, Property Report
  • Limit: The maximum number of records to return.

    • Visible in: Account Report, Property Report
  • Mapping Mode: Enable mapping mode to process multiple data records in batch.

    • Visible in: Account Report, Property Report
  • Metrics: Choose the metrics you want to include in the report.

    • Visible in: Account Report, Property Report
    • Available metrics:
      • dataApiQuotaPropertyTokensConsumed – Data API quota property tokens consumed – All Google Analytics properties
      • accessCount – Number of accesses – Google Analytics 360 Properties
  • Order By: Define how the records should be sorted.

    • Visible in: Account Report, Property Report
    • Syntax: Provide the name of one of the dimensions you selected.
  • Property Name: Select the property you want to query.

    • Visible in: Property Report
  • Tool Name: The name of the tool that will be used when this component is connected as a tool.

    • Visible in: Account Report, Property Report
  • Tool Description: A detailed description of what this tool does.

    • Visible in: Account Report, Property Report
  • Tools arguments metadata: Defines the arguments metadata for the tools.

    • Visible in: Account Report, Property Report

Credential
This component requires a credential of type Analytics API.

  1. Configure the credential in the Credentials section of Nappai.
  2. Select that credential in the Credential field of the component.
    The credential must contain a Client Id, Client Secret, Google analytics access, and Analytics Server Connection URL. These fields are not shown in the input list.

Outputs

  • Data: A structured dataset that contains the rows and columns returned by the Google Analytics API.
  • Tool: A tool representation that can be called by an agent to run the component programmatically.

Usage Example

  1. Drag the Google Analytics component onto the canvas.
  2. Enable Mapping Mode if you want to process many records at once.
  3. Set Operation to Account Report.
  4. Choose an Account Name from the dropdown.
  5. Enter a Date Range Start (e.g., 2024-01-01) and a Date Range End (e.g., 2024-01-31).
  6. Pick a few Dimensions (e.g., accessDateHour, userCountry) and Metrics (e.g., accessCount).
  7. Set Limit to 1000.
  8. Click Run.
    The component will return a Data output that you can feed into a table component or use the Tool output to let an agent fetch the report on demand.
  • Google Analytics Custom – The base component that provides the core functionality for interacting with Google Analytics.
  • Data Table – Display the returned data in a readable table format.
  • Filter – Refine the dataset before passing it to downstream components.

Tips and Best Practices

  • Use the YYYY-MM-DD format for dates to avoid errors.
  • Keep the Limit value reasonable to stay within Google Analytics API quotas.
  • When using Mapping Mode, connect the Mapping Data input to a list of records you want to process.
  • Choose only the dimensions and metrics you need; selecting too many can slow down the request.
  • Store your Analytics API credential securely and never share it publicly.

Security Considerations

  • The component uses OAuth credentials stored in Nappai’s secure credential store.
  • Never expose the credential details in your workflow or share the workflow with users who should not have access.
  • Regularly rotate your Client Id and Client Secret to maintain security.