Google Analytics
Prerequisites
To configure access to the Google Analytics connector, you need:
- Google Service Account credential or a Google User credential
- One or more Google Analytics “View Ids” or a “Property Id”
Google Service Account
To authenticate via a Google Service Account add a Key with the Credential Type Google Service Account
Service accounts differ from user accounts in several key ways.
- Client Email
- Email address associated with the Service Account
- Key Name
- Value set here will be used in your Switchboard Script.
- Key Type
- Corresponds to the format of the Service Account Key. Typically the value is
json
- Service Account Key
- Entire text of the key pair provided when a Service Account is generated
Google OAuth
To authenticate via Oauth you must add a Key with the Credential Type Google OAuth
, enter a Key Name (used in the Switchboard Script below) and perform the Oauth flow by clicking the button labeled Connect
.
Scheduling
The Google Analytics connector can be scheduled to ingest data once per day at a user-defined hour and timezone.
See Daily Scheduling for more information.
Default
Parameters
- view_ids string list
- required
- A list of view identifiers
- dimensions string list
- required
- A list of requested dimensions. For the full list of available dimensions, visit the Dimensions & Metrics Explorer
- filter string
- optional
- A Google Analytics filter statement. Example:
ga:deviceCategory==desktop;ga:sessions>1
- include_empty_rows string
- optional
- metrics string list
-
A list of requested dimensions. For the full list of available metrics, visit the Dimensions & Metrics Explorer. Required - sampling string
- optional
- Allows retrieval of a sample of the full dataset. Allowed values:
DEFAULT
,SMALL
,LARGE
Sample Switchboard Script
import google_analytics_sessions from {
type: "google_analytics";
key: "google_service_account";
view_ids: [
"12345",
"67890"];
dimensions: [
"ga:date",
"ga:country",
"ga:userType",
"ga:referralPath",
"ga:fullReferrer",
"ga:deviceCategory",
"ga:hostname",
"ga:pagePath"];
metrics: [
"ga:users",
"ga:sessions",
"ga:bounces",
"ga:bounceRate",
"ga:sessionDuration",
"ga:hits",
"ga:pageviews",
"ga:pageviewsPerSession",
"ga:uniquePageviews"];
} using {
viewId: integer;
"ga_date": datetime("YYYYMMdd");
"ga_country": string;
"ga_userType": string;
"ga_referralPath": string;
"ga_fullReferrer": string;
"ga_deviceCategory": string;
"ga_hostname": string;
"ga_pagePath": string;
"ga_users": integer;
"ga_sessions": integer;
"ga_bounces": integer;
"ga_bounceRate": float;
"ga_sessionDuration": float;
"ga_hits": integer;
"ga_pageviews": integer;
"ga_pageviewsPerSession": float;
"ga_uniquePageviews": integer;
};
Analytics Report
Parameters
- dimensions string list
- required
- A list of requested dimensions. For the full list of available dimensions, visit the Dimensions & Metrics Explorer
- metrics string list
- required
-
A list of requested dimensions. For the full list of available metrics, visit the Dimensions & Metrics Explorer. Required - property_id string
- required
- A property identifier
Sample Switchboard Script
download t from {
key: "google_analytics_data_key";
type: "google_analytics_data:report";
metrics: ["activeUsers"];
dimensions: ["country"];
property_id: "291342085";
} using {*};
Realtime Report
Parameters
- dimensions string list
- required
- A list of requested dimensions. For the full list of available dimensions, visit the Dimensions & Metrics Explorer
- metrics string list
- required
- A list of requested dimensions. For the full list of available metrics, visit the Dimensions & Metrics Explorer.
- property_id string
- required
- A property identifier
Sample Switchboard Script
download t from {
key: "google_analytics_data_key";
type: "google_analytics_data:realtime_report";
metrics: ["activeUsers"];
dimensions: ["country"];
property_id: "291342085";
} using {*};