Lodol Docs

Google Analytics

API actions for the Google Analytics integration.

Google Analytics

Measure traffic and visitor engagement across your websites.


Get engagement overview

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

Response

{
  "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.

Response

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

Get active users right now

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

Response

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

Get sessions by country

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

Response

{
  "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.

Parameters

ParameterTypeRequiredDescription
limitnumberNoOptional. The maximum number of pages to return (default 10).

Response

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

On this page