GA4 Event
ActionsTags
(2)This action sends offline events to Google Analytics 4 from your repository workflows.
The most common use case is to record deployment events in Google Analytics when updates to your app, website or other system occur. This allows you to attribute changes in other analytics data (such as number of views), against changes in your system (such as a new release or UI update).
Input | Required | Description |
---|---|---|
event-name | false | The name of the event to record in GA4. |
measurement-id | true | The measurement id for your GA4 property. |
api-secret | true | The API secret for you GA4 property. |
dry-run | false | When true , only the validation server will be used to validate the request, and the request will not be sent to your GA4 property. |
property-id | false | The id of you GA4 property. |
service-account-credentials | false | This variable should be passed as a secret, containing the contents of your Google Cloud service account key file credentials in json format. |
The name of the event to record in GA4. Default "update_github"
.
Please Note: It is usually best to start event names with verbs, and to keep it consistent for reporting purposes in GA4.
All events will contain the description and URL of the commit that triggered the workflow.
Required The measurement id for your GA4 property.
Required The API secret for you GA4 property.
The API secret can be generated through the GA4 UI.
To create a new secret, navigate in the Google Analytics UI to Admin > Data Streams > choose your stream > Measurement Protocol > Create
When true, only the validation server will be used to validate the request, and the request will not be sent to your GA4 property.
The id of you GA4 property. If this value is set, the action will configure custom dimensions to make viewing event data easier.
If property-id is defined, you must also provide service account credentials.
Note: the property id is not the same as your tracking id! It is a number that can be found in Admin > Property Settings > Top left corner
This variable should be passed as a secret, containing the contents of your Google Cloud service account key file credentials in json format.
Defining the
property-id
andservice-account-credentials
arguments will allow custom dimensions to be automatically configured in your GA4 property. Configuring these dimensions will allow you to view your event data in reports Please see below to configure this correctly.
In order to use the functionality of auto-configured custom dimensions, a service account needs to be created. Follow the steps below:
- Login to Google Cloud.
- Create a new cloud project or use an existing one.
- Once your project is selected, in the side-bar select IAM & Admin.
- Navigate to Service Accounts.
- Create a new service account and download the credentials as a json file.
- Copy the contents of the json file into a GitHub secret.
- Enable the Google Analytics Admin API for your project in Google Cloud to grant the service account access to the API.
- Open your GA4 property and add the service account (via the generated email) to your property with editor privileges.
uses: Dylan700/ga4-action@latest
with:
event-name: update_website
measurement-id: ${{secrets.ga4_measurement_id}}
api-secret: ${{secrets.ga4_api_secret}}
You can view your GitHub Events using the realtime view, or if you've enabled autoconfigured dimensions, you can view by description and url, or create a custom card.
Contributions are welcome! If you have something to add or fix, just make a pull request to be reviewed.
GA4 Event is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.