Google Analytics GA4 plugin
How to add the Google Analytics GA4 plugin
There are two Google Analytics plugins, this article covers the v4 version which is most frequently referred to as GA4. Users are being forced from UA to the newer GA4 with UA being end-of-life mid-2023.
See Google Analytics UA plugin
Prerequisites
In the GCP console select your project and check that the following are enabled:
Google Analytics Data API
Google Analytics Admin API are enabled
GCP Service Account Configuration
Create a new Service Account, or edit an existing account.
Ensure the account has the role Viewer by adding the role Basic > Viewer.
Create a new key for the Service Account using the key type JSON. Download the JSON file as you will need to copy information from this JSON file when adding the plugin next.
See GCP - Creating service account keys
Make sure to store the key file securely, because it can be used to authenticate as your service account.
Add the Google Analytics plugin to SquaredUp
In SquaredUp browse to Settings > Plugins > Add plugin and search for the plugin.
Open the JSON file that you downloaded when creating the key.
Copy and paste the clientEmailfrom the JSON file into the plugin form.
Copy and paste the private_key from the JSON file into the plugin form (everything between the quotes).
Leave the checkbox for Automatically create a workspace ticked, this will create a new workspace for this plugin containing out of the box dashboards and scopes.
Optionally, select whether you would like to restrict access to this plugin instance. By default, restricted access is set to off.
Restrict access to this plugin?
The term plugin here really means plugin instance. For example, a user may configure two instances of the AWS plugin, one for their development environment and one for production. In that case, each plugin instance has its own access control settings.
By default, Restrict access to this plugin? is set to off. The plugin can be viewed, edited and administered by anyone. If you would like to control who has access to this plugin, switch Restrict access to this plugin? to on.
Use the Restrict access to this plugin? dropdown to control who has access to the workspace:
By default, the user setting the permissions for the plugin will be given Full Control and the Everyone group will be given Link to workspace permissions.
Tailor access to the plugin, as required, by selecting individual users or user groups from the dropdown and giving them Link to workspace or Full Control permissions.
If the user is not available from the dropdown, you are able to invite them to the plugin by typing in their email address and then clicking Add. The new user will then receive an email inviting them to create an account on SquaredUp Cloud. Once the account has been created, they will gain access to the tenant.
At least one user or group must be given Full Control.
Admin users can edit the configuration, modify the Access Control List (ACL) and delete the plugin, regardless of the ACL chosen.
Plugin access levels
Access Level:
Link to workspace
- User can link the plugin to any workspace they have at least Editor permissions for.
- Data from the plugin can then be viewed by anyone with any access to the workspace.
User can share the plugin data with anyone they want.
User cannot configure the plugin in any way, or delete it.
Full Control - User can change the plugin configuration, ACL, and delete the plugin.
See Access control for more information.
Click Save.
Using the Google Analytics GA4 plugin
Creating data streams for the Google Analytics GA4 plugin

A configurable data stream allows you to easily create new data streams specific to your needs, by entering information into a form, such as metric names or queries. Configurable data streams have a + before the name, and once new data streams have been created they show in the normal list of data streams.
Any data streams you create can be edited from Settings > Data Streams.
The plugin will import the Google Analytics accounts and the properties which belong to them. Currently all data streams require that at least one Properties item be scoped to produce data. Once scoped the user will have the choice of a couple built-in data streams as well as three configurable data streams details below.
The GA4 Query Explorer can be helpful for looking up metrics and dimensions.
Metric Query (GA4)
This configurable data stream accepts one or more metrics (e.g. activeUsers) and returns that metric for the scoped property in a graphable format.
Optionally, a single dimension (e.g. browser) returns the data grouped by the dimension for the scoped property. Using these two examples would give you website users per browser.
Report Query (GA4)
This is the least constrictive configurable data stream. It accepts JSON request format found at the bottom of the GA4 Query Explorer page, and will return data as a table.
Comments
0 comments
Please sign in to leave a comment.