🔗
Demo to preview the settings
🔗
Introduction
This plugin lets authorized users access the details of their Google Analytics accounts and retrieve their reports.
Prerequisites
You must have a Google developer account and Google Analytics account to use the plugin.
- You must create a project with OAuth authentication.
- You must create accounts on Google Analytics.
How to setup
I. How to create a project with OAuth
- For the first time, select your country and accept the Terms of Service.
- Go to Select a project or current project, like in the images below. It will open a pop-up.
- In the opened pop-up, press the NEW PROJECT button.
- Set the Project name and press CREATE.
- After the project creation, select a created project and go to Select a project or current project, like in the images below. It will open a pop-up.
- In the opened pop-up, select created project.
Set up OAuth consent screen
- From the navigation menu select APIs & Services.
- From APIs & Services, select OAuth consent screen.
- Here, select External and press CREATE button.
- On OAuth consent screen step, complete all required fields then press SAVE AND CONTINUE button.
- On the Scopes step, press the SAVE AND CONTINUE button.
- On the Test users step, add your account to be able to test your app, then press SAVE AND CONTINUE button. Also, you can add more accounts for testing.
- On the Summary step, see added info and press BACK TO DASHBOARD.
Create credentials to access enabled APIs
- From APIs & Services, select Credentials.
- From the Credentials page, press CREATE CREDENTIALS button.
- Select OAuth client ID.
- Select Web application for the Application type option.
- Set up the Name option.
- Add Authorized redirect URIs and press CREATE.
You can get an authorized redirect URI from the plugin settings page.
Now you have App ID (Client ID) and App Secret (Client Secret).
Enable Google Analytics API and Google Analytics Reporting API
- From APIs & Services, select Library.
- Scroll down to Other category and select Google Analytics API.
- On opened page, press ENABLE button. It will open library page.
- Go back to the Google Analytics API library. Where you enable the library.
- Scroll down to More products to explore and select Google Analytics Reporting API.
- On the opened page, press ENABLE button. It will open library page.
II. How to create a Google Analytics account
For using this plugin you must have at least one Google Analytics account. If you don’t have one of these, follow the next steps to create one.
- Press Start measuring.
- On the Account setup step, complete all fields and press the Next button.
- On the Property setup step, complete all fields.
- Press Show advanced options.
- Toggle ON Create a Universal Analytics property.
- Input the Website URL that you want to track, select Create both a Google Analytics 4 and a Universal Analytics property, and press the Next button.
- On the About your business step, complete info about your company and press Create.
- Accept Google Analytics Terms of Service Agreement.
- In the opened page, save MEASUREMENT ID (Gtag).
Now you have Gtag!
Also, you can find this Tag from Admin → Account → Property → Data Streams after pressing on wished stream.
- To start collecting data from your websites, consult instructions from View tag instructions.
That is all, now you can use this plugin.
III. How to setup all keys in the plugin
Now, it is time to put all obtained keys in plugin settings.
- Go to the plugin settings page.
- Paste App ID and App Secret in plugin settings. These keys you obtained from the above section How to setup → I. How to create a project with OAuth → Create credentials to access enabled APIs on step 20.
- **Paste Gtag (headers) and Gtag in plugin settings. This key you obtained from the above section How to setup → II. How to create a Google Analytics account on step 10.
☝
**Paste Gtag (headers) and Gtag in plugin settings if you want to collect analytics data from this Bubble app.
API Calls
☝
Plugin Data Calls (DEPRECATED)
Get List of Account - Lists all accounts to which the user has access.
Returns:
Title | Description | Type |
kind | Collection type. Value is “analytics#accounts”. | string |
username | Email ID of the authenticated user | string |
totalResults | The total number of results for the query, regardless of the number of results in the response. | number |
startIndex | The starting index of the entries, which is 1 by default or otherwise specified by the start-index
query parameter. | number |
itemsPerPage | The maximum number of entries the response can contain, regardless of the actual number of entries returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results
query parameter. | number |
previousLink | Previous link for this account collection. | string |
nextLink | Next link for this account collection. | string |
items[] | A list of accounts. | list |
Retrieve Reports - Gives you access to most of the report data in Google Analytics.
Fields:
Title | Description | Type |
end-date | End date for fetching Analytics data. Request can specify an end date formatted as YYYY-MM-DD
, or as a relative date (e.g., today
, yesterday
, or NdaysAgo
where N
is a positive integer). | string |
ids | The unique table ID of the form ga:XXXX, where XXXX is the Analytics view (profile) ID for which the query will retrieve the data. | string |
start-date | Start date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD
, or as a relative date (e.g., today
, yesterday
, or NdaysAgo
where N
is a positive integer). | string |
metrics | A list of comma-separated metrics, such as ga:sessions,ga:bounces
. | string |
filters | Dimension or metric filters that restrict the data returned for your request. | string (optional) |
dimensions | A list of comma-separated dimensions for your Analytics data, such as ga:browser,ga:city
. | string (optional) |
sort | A list of comma-separated dimensions and metrics indicating the sorting order and sorting direction for the returned data. | string (optional) |
max-results | The maximum number of rows to include in the response. | number (optional) |
prettyPrint | Returns response with indentations and line breaks. Default false
. | string (optional) |
Returns:
Title | Description | Type |
kind | Resource type. Value is "analytics#gaData". | string |
id | An ID for this data response. | string |
query | This object contains all the values passed as parameters to the query. The meaning of each field is explained in the description of its corresponding query parameter. | object |
query.start-date | Start date. | string |
query.end-date | End date. | string |
query.ids | Unique table ID. | string |
query.metrics[] | List of analytics metrics. | list |
query.start-index | Start index. | number |
query.max-results | Maximum results per page. | number |
itemsPerPage | The maximum number of rows the response can contain, regardless of the actual number of rows returned. If the max-results
query parameter is specified, the value of itemsPerPage
is the smaller of max-results
or 10,000. The default value of itemsPerPage
is 1000. | number |
totalResults | The total number of rows in the query result, regardless of the number of rows returned in the response. For queries that result in a large number of rows, totalResults
can be greater than itemsPerPage
. See Paging
for more explanation of totalResults
and itemsPerPage
for large queries. | number |
selfLink | Link to this page of results for this data query. | string |
profileInfo | Information about the view (profile) for which the data was requested. View (Profile) data is available through the Google Analytics Management API. | object |
profileInfo.profileId | View (Profile) ID, such as 1174. | string |
profileInfo.accountId | Account ID to which this view (profile) belongs, such as 30481. | string |
profileInfo.webProfileId | Web Property ID to which this view (profile) belongs, such as UA-30481-1. | string |
profileInfo.internalWebProfileId | Internal ID for the web property to which this view (profile) belongs, such as UA-30481-1. | string |
profileInfo.profileName | Name of the view (profile). | string |
profileInfo.tableId | Table ID for view (profile), consisting of "ga:" followed by the view (profile) ID. | string |
containsSampledData | True if the response contains sampled
data. | boolean |
columnHeaders[] | Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as those specified in the request through the metrics
and dimensions
parameters. The number of headers is the number of dimensions + the number of metrics. | list |
columnHeaders[].name | Name of the dimension or metric. | string |
columnHeaders[].columnType | Column type. Either "DIMENSION" or "METRIC". | string |
columnHeaders[].dataType | Data type. Dimension column headers have only STRING
as data type. Metric column headers have data types for metric values such as INTEGER, PERCENT, TIME, CURRENCY, FLOAT, etc. See the metadata API response for all the possible data types. | string |
totalsForAllResults | Total values for the requested metrics as key-value pairs of metric names and values. The order of the metric totals is same as the metric order specified in the request. | object |
totalsForAllResults.(key) | Key-value pair for the total value of a metric. Key is the metric name and the value is the total value for that metric. | string |
rows[] | Analytics data rows, where each row contains a list of dimension values followed by the metric values. The order of dimensions and metrics is same as specified in the request. Each row has a list of N fields, where N = the number of dimensions + the number of metrics. | list |
Real Time Data - Returns real-time data for a view (profile).
Fields:
Title | Description | Type |
ids | Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. | string |
metrics | A comma-separated list of Analytics metrics. E.g., 'rt:activeUsers'. At least one metric must be specified. | string |
dimensions | A comma-separated list of real-time dimensions. E.g., 'rt:medium,rt:city'. | string (optional) |
filters | A comma-separated list of dimension or metric filters to be applied to real-time data. | string (optional) |
max-results | The maximum number of entries to include in this feed. | number (optional) |
sort | A comma-separated list of dimensions or metrics that determine the sort order for real-time data. | string (optional) |
Returns:
Title | Description | Type |
kind | Resource type. | string |
id | Unique ID for this data response. | string |
query | Real time data request query parameters. | object |
query.ids | Unique table ID. | string |
query.dimensions | List of real time dimensions. | string |
query.metrics[] | List of real time metrics. | list |
query.sort[] | List of dimensions or metrics based on which real time data is sorted. | list |
query.filters | Comma-separated list of dimension or metric filters. | string |
query.max-results | Maximum results per page. | number |
totalResults | The total number of rows for the query, regardless of the number of rows in the response. | number |
selfLink | Link to this page. | string |
profileInfo | Information for the view (profile), for which the real time data was requested. | object |
profileInfo.profileId | View (Profile) ID. | string |
profileInfo.accountId | Account ID to which this view (profile) belongs. | string |
profileInfo.webPropertyId | Web Property ID to which this view (profile) belongs. | string |
profileInfo.internalWebPropertyId | Internal ID for the web property to which this view (profile) belongs. | string |
profileInfo.profileName | View (Profile) name. | string |
profileInfo.tableId | Table ID for view (profile). | string |
columnHeaders[] | Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as specified in the request. | list |
columnHeaders[].name | Column name. | string |
columnHeaders[].columnType | Column Type. Either DIMENSION or METRIC. | string |
columnHeaders[].dataType | Data type. Dimension column headers have only STRING as the data type. Metric column headers have data types for metric values such as INTEGER, DOUBLE, CURRENCY etc. | string |
totalsForAllResults | Total values for the requested metrics over all the results, not just the results returned in this response. The order of the metric totals is same as the metric order specified in the request. | object |
totalsForAllResults.(key) | Key-value pair for the total value of a metric. Key is the metric name and the value is the total value for that metric. | string |
rows[] | Real time data rows, where each row contains a list of dimension values followed by the metric values. The order of dimensions and metrics is same as specified in the request. | list |
List Views - Lists views (profiles) to which the user has access.
Fields:
Title | Description | Type |
accountId | Account ID for the view (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access. | string |
webPropertyId | Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access. | string |
Returns:
Title | Description | Type |
kind | Collection type. Value is "analytics#profiles". | string |
username | Email ID of the authenticated user | string |
totalResults | The total number of results for the query, regardless of the number of results in the response. | number |
startIndex | The starting index of the resources, which is 1 by default or otherwise specified by the start-index query parameter. | number |
itemsPerPage | The maximum number of resources the response can contain, regardless of the actual number of resources returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results query parameter. | number |
previusLink | Link to the previous page for this view (profile) collection. | string |
nextLink | Link to next page for this view (profile) collection. | string |
items[] | A list of views (profiles). | list |
List webproperties - Lists properties to which the user has access.
Fields:
Title | Description | Type |
accountId | Account ID to retrieve web properties. Can either be a specific account ID or '~all', which refers to all the accounts that the user has access. | string |
Returns:
Title | Description | Type |
kind | Collection type. Value is "analytics#profiles". | string |
username | Email ID of the authenticated user | string |
totalResults | The total number of results for the query, regardless of the number of results in the response. | number |
startIndex | The starting index of the resources, which is 1 by default or otherwise specified by the start-index query parameter. | number |
itemsPerPage | The maximum number of resources the response can contain, regardless of the actual number of resources returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results query parameter. | number |
previusLink | Link to the previous page for this web property collection. | string |
nextLink | Link to next page for this web property collection. | string |
items[] | A list of web properties. | list |
Get accounts info - Lists account summaries (lightweight tree comprised of accounts/properties/profiles) to which the user has access.
Returns:
Title | Description | Type |
kind | Collection type. | string |
username | Email ID of the authenticated user | string |
totalResults | The total number of results for the query, regardless of the number of results in the response. | number |
startIndex | The starting index of the resources, which is 1 by default or otherwise specified by the start-index query parameter. | number |
itemsPerPage | The maximum number of resources the response can contain, regardless of the actual number of resources returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results query parameter. | number |
previusLink | Link to the previous page for this AccountSummary collection. | string |
nextLink | Link to next page for this AccountSummary collection. | string |
items[] | A list of AccountSummaries. | list |
Retrieve Reports v4 - Returns the Analytics data.
Fields:
Title | Description | Type |
viewId | The Analytics view ID
from which to retrieve data. Every ReportRequest
within a batchGet
method must contain the same viewId. | string |
Returns:
Title | Description | Type |
reports[] | Responses corresponding to each of the request. | list |
Plugin Action Calls (DEPRECATED)
Real Time Data (action) - Returns real-time data for a view (profile).
Fields:
Title | Description | Type |
ids | Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. | string |
metrics | A comma-separated list of Analytics metrics. E.g., 'rt:activeUsers'. At least one metric must be specified. | string |
dimensions | A comma-separated list of real-time dimensions. E.g., 'rt:medium,rt:city'. | string (optional) |
filters | A comma-separated list of dimension or metric filters to be applied to real-time data. | string (optional) |
max-results | The maximum number of entries to include in this feed. | number (optional) |
sort | A comma-separated list of dimensions or metrics that determine the sort order for real-time data. | string (optional) |
Returns:
Title | Description | Type |
kind | Resource type. | string |
id | Unique ID for this data response. | string |
query | Real time data request query parameters. | object |
query.ids | Unique table ID. | string |
query.dimensions | List of real time dimensions. | string |
query.metrics[] | List of real time metrics. | list |
query.sort[] | List of dimensions or metrics based on which real time data is sorted. | list |
query.filters | Comma-separated list of dimension or metric filters. | string |
query.max-results | Maximum results per page. | number |
totalResults | The total number of rows for the query, regardless of the number of rows in the response. | number |
selfLink | Link to this page. | string |
profileInfo | Information for the view (profile), for which the real time data was requested. | object |
profileInfo.profileId | View (Profile) ID. | string |
profileInfo.accountId | Account ID to which this view (profile) belongs. | string |
profileInfo.webPropertyId | Web Property ID to which this view (profile) belongs. | string |
profileInfo.internalWebPropertyId | Internal ID for the web property to which this view (profile) belongs. | string |
profileInfo.profileName | View (Profile) name. | string |
profileInfo.tableId | Table ID for view (profile). | string |
columnHeaders[] | Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as specified in the request. | list |
columnHeaders[].name | Column name. | string |
columnHeaders[].columnType | Column Type. Either DIMENSION or METRIC. | string |
columnHeaders[].dataType | Data type. Dimension column headers have only STRING as the data type. Metric column headers have data types for metric values such as INTEGER, DOUBLE, CURRENCY etc. | string |
totalsForAllResults | Total values for the requested metrics over all the results, not just the results returned in this response. The order of the metric totals is same as the metric order specified in the request. | object |
totalsForAllResults.(key) | Key-value pair for the total value of a metric. Key is the metric name and the value is the total value for that metric. | string |
rows[] | Real time data rows, where each row contains a list of dimension values followed by the metric values. The order of dimensions and metrics is same as specified in the request. | list |
Plugin Data Calls
Retrieve Reports GA4 - Returns a customized report of your Google Analytics event data.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
Property ID | A Google Analytics GA4 property identifier whose events are tracked. | text |
Start Date | The inclusive start date for the query in the format YYYY-MM-DD . Cannot be after endDate . The format NdaysAgo , yesterday , or today is also accepted, and in that case, the date is inferred based on the property's reporting time zone. Incorporate the value in quotation marks ("). | text |
End Date | The inclusive end date for the query in the format YYYY-MM-DD . Cannot be before startDate . The format NdaysAgo , yesterday , or today is also accepted, and in that case, the date is inferred based on the property's reporting time zone. Incorporate the value in quotation marks ("). | text |
Metric | The name of the metric. See the API Metrics for the list of metric names supported by core reporting methods. Incorporate the value in quotation marks ("). | text |
Dimension | The name of the dimension. See the API Dimensions for the list of dimension names supported by core reporting methods. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Offset | The row count of the start row. The first row is counted as row 0. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Limit | The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. limit must be positive. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Returns:
☝
The call returns different parameters depending on the inserted values in the call’s fields. Check here for a more detailed response.
Get List of Accounts GA4 - Returns all accounts accessible by the caller.
Returns:
☝
The call returns different parameters. Check here for a more detailed response.
Get List of DataStreams GA4 - Lists DataStreams on a property.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
Property ID | A Google Analytics GA4 property identifier whose events are tracked. | text |
pageSize | The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum). | number (optional) |
pageToken | A page token, received from a previous call. | text (optional) |
Returns:
☝
The call returns different parameters depending on the inserted values in the call’s fields. Check here for a more detailed response.
RealTime Reports GA4 - Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
Property ID | A Google Analytics GA4 property identifier whose events are tracked. | text |
Metric | The name of the metric. See the API Metrics for the list of metric names supported by core reporting methods. Incorporate the value in quotation marks ("). | text |
Dimension | The name of the dimension. See the API Dimensions for the list of dimension names supported by core reporting methods. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Limit | The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. limit must be positive. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Returns:
☝
The call returns different parameters depending on the inserted values in the call’s fields. Check here for a more detailed response.
Get List of Properties GA4 - Returns child Properties under the specified parent Account.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
Account ID | The ID of the account to lookup. | text |
Returns:
☝
The call returns different parameters. Check here for a more detailed response.
Get Accounts Info GA4 - Returns summaries of all accounts accessible by the caller.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
pageSize | The maximum number of resources to return. If unspecified, at most 50 resources will be returned. The maximum value is 200 (higher values will be coerced to the maximum). | number (optional) |
pageToken | A page token, received from a previous call. | text (optional) |
Returns:
☝
The call returns different parameters. Check here for a more detailed response.
Plugin Action Calls
RealTime Reports GA4 (action) - Returns a customized report of realtime event data for your property. Events appear in realtime reports seconds after they have been sent to the Google Analytics.
Fields:
💡
Check the official documentation for more detailed information about the call’s fields.
Title | Description | Type |
Property ID | A Google Analytics GA4 property identifier whose events are tracked. | text |
Metric | The name of the metric. See the API Metrics for the list of metric names supported by core reporting methods. Incorporate the value in quotation marks ("). | text |
Dimension | The name of the dimension. See the API Dimensions for the list of dimension names supported by core reporting methods. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Limit | The number of rows to return. If unspecified, 10,000 rows are returned. The API returns a maximum of 250,000 rows per request, no matter how many you ask for. limit must be positive. For non-empty values, incorporate the value in quotation marks ("). | text (optional) |
Returns:
☝
The call returns different parameters depending on the inserted values in the call’s fields. Check here for a more detailed response.
Workflow example
Setup Authorization
In this workflow, it is represented how to add steps for authorization with Google Account.
- On the page, is placed an Authorization button.
- In the workflow, is created an event When Button Authorization is clicked with the following step.
- To add Signup/login with Google Analytics step is necessary:
3.1 To click on Click here to add an action… and select Signup with a social network.
3.2 In the opened pop-up, for OAuth provider option, select Google Analytics.
Getting info about Google Analytics account (DEPRECATED)
☝
Attention: This workflow example contains DEPRECATED Calls. All DEPRECATED Calls will work until July 1, 2024. Check more details here.
In this workflow, it is represented how data about Google Analytics accounts is shown.
- On the page, is placed a Dropdown element.
- In the workflow, is created an event When Dropdown’s value is changed with the following steps.
- The first step is necessary to clear the previous profileID if this exists.
- The second step is necessary to set accountID.
- The third step is necessary to set profileID. In account can be more profiles. Here is getting the first.
- This step is used to get data about user's activity.
- Obtained data from the previous step is saved.
- Getting Reports with version 3.
- Getting Reports with version 4.
How it looks on the page
Presented data on the page can be customized.
Getting data from Google Analytics
In this workflow, it is represented how are used some plugin calls for getting data from Google Analytics.
- On the page is placed the following Dropdown element. The Dropdown will contain the list of all available accounts.
- In the Workflow tab, when the User is logged in, the Get Accounts Info GA4 call is used to populate the state “list of accounts” that is used in the Dropdown above.
Detailed Get Accounts Info GA4 call:
- In the Workflow tab, the Dropdown Accounts’s value is changed event has the following steps.
- The first step is used to reset the previous “propertyID” if this exists and to set the “accountID” state.
- The second step is used to set the “propertyID” state.
- Getting the Property Name by using the Get List of Properties GA call.
- Getting reports data by using the Retrieve Reports GA4 call.
- Getting real-time reports data by using the RealTime Reports GA4 call.
How it looks on the preview
☝
Presented data on the page can be customized.
Changelogs
Update 27.02.24 - Version 1.21.0
- Migrated actions to Google Analytics 4.
Update 08.11.22 - Version 1.13.0
- Added "id" parameter for "Retrieve Reports v4”.
Update 29.07.22 - Version 1.12.0
- Added support for Google analytics v4.
Update 09.06.21 - Version 1.10.0
- Added support for more metrics to api call "Retrieve Reports”
Update 22.10.20 - Version 1.8.0
- Updated credentials and API Call’s.
Update 10.05.18 - Version 1.3.0
- Added offline mode support and real time reports.
Update 08.09.17 - Version 1.0.0
- Initial Build.