Google Analytics

Events by device

GET
/v1/google-analytics/events-by-device

GA4 events of the period summed per event and device category, for the audit (carts add_to_cart, purchases purchase, leads form_submit, ...). One item per event with its period total and its devices, both by event count, highest first. Reads google_analytics_events_by_device (date x event x device). Aggregates only. Without eventNames every event of the period is returned. An event without rows in the period is not listed; a period without data answers 200 with an empty events. An environment where google_analytics_events_by_device does not exist yet answers like a period without data: 200 with period and an empty events. Both dates are required; the period spans at most 366 days. Cached for 30 minutes.

Autorização

ClientIdAuthClientSecretAuth
headerx-client-id<token>

Client ID

headerx-client-secret<token>

Client secret

Parâmetros de query

organizationId*string

Organization identifier (UUID, required)

Formatouuid
startDate*string

First day of the period, inclusive (YYYY-MM-DD, UTC). Required.

Formatodate
endDate*string

Last day of the period, inclusive (YYYY-MM-DD, UTC). Required. At most 366 days from startDate.

Formatodate
eventNames?array<string>

GA4 event names to return, comma-separated or repeated (up to 50; letters, digits and underscores, starting with a letter, 40 characters at most). Every event when absent.

Itensitems <= 50

Corpo da resposta

Successful response

application/json
  1. response
period*
events*array<>

One item per event with rows in the period, most fired first.

curl -X GET "https://example.com/v1/google-analytics/events-by-device?organizationId=11111111-1111-4111-8111-111111111111&startDate=2026-10-01&endDate=2026-10-02&eventNames=add_to_cart%2Cpurchase%2Cform_submit"
{  "period": {    "startDate": "2026-10-01",    "endDate": "2026-10-31"  },  "events": [    {      "eventName": "add_to_cart",      "eventCount": 200,      "keyEvents": 0,      "eventValue": 0,      "transactions": 0,      "byDevice": [        {          "device": "mobile",          "eventCount": 160,          "keyEvents": 0,          "eventValue": 0,          "transactions": 0        },        {          "device": "desktop",          "eventCount": 40,          "keyEvents": 0,          "eventValue": 0,          "transactions": 0        }      ]    },    {      "eventName": "purchase",      "eventCount": 20,      "keyEvents": 20,      "eventValue": 2199.75,      "transactions": 19,      "byDevice": [        {          "device": "mobile",          "eventCount": 12,          "keyEvents": 12,          "eventValue": 1200.5,          "transactions": 12        },        {          "device": "desktop",          "eventCount": 8,          "keyEvents": 8,          "eventValue": 999.25,          "transactions": 7        }      ]    }  ]}