# Google Analytics

> Measure traffic and visitor engagement across your websites.

App · Analytics · 5 actions. Web page: https://docs.lodol.com/docs/integrations/google-analytics

## Actions

### Get active users right now

See how many people are using your website or app right now, updated in real time.

**Inputs**

- Property ID (`property_id`, text, required): Your Google Analytics 4 property ID, for example 123456789. You can find it in Google Analytics under Admin > Property Settings.

**Outputs**

- `metadata` (object): The dimension and metric names that make up the columns.
- `rowCount` (number): Total number of rows that matched the report.
- `rows` (list): The report data, one object per row.

**Example output**

```json
{
  "metadata": {
    "dimensions": [],
    "metrics": [
      "activeUsers"
    ]
  },
  "rowCount": 1,
  "rows": [
    {
      "activeUsers": "42"
    }
  ]
}
```

### Get engagement overview

See daily totals for users, page views, and time spent on your site over a date range.

**Inputs**

- Property ID (`property_id`, text, required): Your Google Analytics 4 property ID, for example 123456789. You can find it in Google Analytics under Admin > Property Settings.
- Start date (`start_date`, text, required): The first day to include. Use a calendar date like 2024-01-01, or a relative value like 7daysAgo, yesterday, or today.
- End date (`end_date`, text, required): The last day to include. Use a calendar date like 2024-01-31, or a relative value like today or yesterday.

**Outputs**

- `metadata` (object): The dimension and metric names that make up the columns.
- `rowCount` (number): Total number of rows that matched the report.
- `rows` (list): The report data, one object per row.

**Example output**

```json
{
  "metadata": {
    "dimensions": [
      "date"
    ],
    "metrics": [
      "totalUsers",
      "screenPageViews",
      "userEngagementDuration"
    ]
  },
  "rowCount": 7,
  "rows": [
    {
      "date": "20240115",
      "screenPageViews": "5000",
      "totalUsers": "1000",
      "userEngagementDuration": "36000"
    }
  ]
}
```

### Get event counts

See how many times each tracked event happened over a date range.

**Inputs**

- Property ID (`property_id`, text, required): Your Google Analytics 4 property ID, for example 123456789. You can find it in Google Analytics under Admin > Property Settings.
- Start date (`start_date`, text, required): The first day to include. Use a calendar date like 2024-01-01, or a relative value like 7daysAgo, yesterday, or today.
- End date (`end_date`, text, required): The last day to include. Use a calendar date like 2024-01-31, or a relative value like today or yesterday.

**Outputs**

- `metadata` (object): The dimension and metric names that make up the columns.
- `rowCount` (number): Total number of rows that matched the report.
- `rows` (list): The report data, one object per row.

**Example output**

```json
{
  "metadata": {
    "dimensions": [
      "eventName"
    ],
    "metrics": [
      "eventCount"
    ]
  },
  "rowCount": 3,
  "rows": [
    {
      "eventCount": "10000",
      "eventName": "page_view"
    },
    {
      "eventCount": "5000",
      "eventName": "scroll"
    },
    {
      "eventCount": "2500",
      "eventName": "click"
    }
  ]
}
```

### Get sessions by country

See how many visits came from each country over a date range.

**Inputs**

- Property ID (`property_id`, text, required): Your Google Analytics 4 property ID, for example 123456789. You can find it in Google Analytics under Admin > Property Settings.
- Start date (`start_date`, text, required): The first day to include. Use a calendar date like 2024-01-01, or a relative value like 7daysAgo, yesterday, or today.
- End date (`end_date`, text, required): The last day to include. Use a calendar date like 2024-01-31, or a relative value like today or yesterday.

**Outputs**

- `metadata` (object): The dimension and metric names that make up the columns.
- `rowCount` (number): Total number of rows that matched the report.
- `rows` (list): The report data, one object per row.

**Example output**

```json
{
  "metadata": {
    "dimensions": [
      "country"
    ],
    "metrics": [
      "sessions"
    ]
  },
  "rowCount": 3,
  "rows": [
    {
      "country": "United States",
      "sessions": "5000"
    },
    {
      "country": "United Kingdom",
      "sessions": "2500"
    },
    {
      "country": "Canada",
      "sessions": "1200"
    }
  ]
}
```

### Get top pages

See which pages got the most views over a date range.

**Inputs**

- Property ID (`property_id`, text, required): Your Google Analytics 4 property ID, for example 123456789. You can find it in Google Analytics under Admin > Property Settings.
- Start date (`start_date`, text, required): The first day to include. Use a calendar date like 2024-01-01, or a relative value like 7daysAgo, yesterday, or today.
- End date (`end_date`, text, required): The last day to include. Use a calendar date like 2024-01-31, or a relative value like today or yesterday.
- Number of pages (`limit`, number): Optional. The maximum number of pages to return (default 10).

**Outputs**

- `metadata` (object): The dimension and metric names that make up the columns.
- `rowCount` (number): Total number of rows that matched the report.
- `rows` (list): The report data, one object per row.

**Example output**

```json
{
  "metadata": {
    "dimensions": [
      "pagePath"
    ],
    "metrics": [
      "screenPageViews"
    ]
  },
  "rowCount": 3,
  "rows": [
    {
      "pagePath": "/",
      "screenPageViews": "5000"
    },
    {
      "pagePath": "/about",
      "screenPageViews": "2500"
    },
    {
      "pagePath": "/contact",
      "screenPageViews": "1200"
    }
  ]
}
```
