Graphrt

Google Analytics

Reports with plain dimension/metric names, realtime, pivot and batch reports, metadata and compatibility, accounts, properties and data streams (OAuth or service account)

Beta v0.1.0 Node.js 11 actions
Use in Graphrt Desktop

About

A Graphrt plugin for Google Analytics 4: reports through the Data API v1beta and account, property and data stream discovery through the Admin API v1beta. It is read-only. Universal Analytics properties are not supported (Google shut them down).

What it can do

  • run_report: dimensions × metrics over up to 4 date ranges, with dimension and metric filters, sorting, limit/offset (up to 250,000 rows, rowCount gives the total), totals (metric_aggregations), comparisons, cohorts and currency
  • run_realtime_report: the last 30 minutes (60 for Analytics 360), up to 2 minute ranges
  • run_pivot_report: pivot tables
  • batch_run_reports: up to 5 reports in one call (each item uses the API's field names: dateRanges, orderBys, ...)
  • get_metadata: every dimension and metric of a property, including custom ones (property_id: "0" for the common ones only)
  • check_compatibility: which dimensions and metrics can be combined
  • list_account_summaries, list_properties, get_property, list_data_streams: find property ids, time zones, currencies and measurement ids (Admin API)
  • api_request: any other Data API endpoint (GET only for agents)

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Run report google-analytics.run_report
  • Realtime report google-analytics.run_realtime_report
  • Pivot report google-analytics.run_pivot_report
  • Batch reports google-analytics.batch_run_reports
  • Dimensions and metrics google-analytics.get_metadata
  • Check compatibility google-analytics.check_compatibility
  • Accounts and properties google-analytics.list_account_summaries
  • List properties google-analytics.list_properties
  • Get property google-analytics.get_property
  • List data streams google-analytics.list_data_streams
Show all 11 actions
  • Google Analytics Data API request google-analytics.api_request

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • GOOGLE_REFRESH_TOKEN
    OAuth refresh trio (scope analytics.readonly)
  • GOOGLE_SERVICE_ACCOUNT_JSON
    Path to a service account key file, add the service account's email as a Viewer of each property (Admin → Property access management)
  • GOOGLE_ACCESS_TOKEN
    A ready access token (used only when neither of the above is set)
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_ANALYTICS_TOOL_TOKEN_SOURCE

How to use it

In Graphrt Desktop

  1. Open Plugins and search for Google Analytics.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install google-analytics
workflow.yaml
- id: top_pages
  type: google-analytics.run_report
  property_id: "{{#start.property#}}"
  dimensions: [pagePath]
  metrics: [screenPageViews, activeUsers]
  date_ranges: [{ startDate: 28daysAgo, endDate: yesterday }]
  dimension_filter: { filter: { fieldName: country, stringFilter: { value: Indonesia } } }
  order_bys: [{ metric: { metricName: screenPageViews }, desc: true }]
  limit: 20
- id: now
  type: google-analytics.run_realtime_report
  property_id: "{{#start.property#}}"
  metrics: [activeUsers]
Plugins in the docs