Google Cloud Storage
Overview
Sending transformed data to a Google Cloud Storage bucket is the most common pattern for Decode GA4 users, and is extremely simple: just install using the events_external template as described in the Quick Install (External) section.
This is equivalent to to installing via the installer app and selecting the Quick Install (External) option from the dropdown menu.
Requirements
When using GCS as an external destination, the executing user or service account must have the following roles:
- Storage Object User (
roles/storage.objectUser) - or both:
- Storage Object Viewer (
roles/storage.objectViewer) - Storage Object Creator (
roles/storage.objectCreator)
- Storage Object Viewer (
These permissions are required on either the destination bucket or the project in which the bucket is located.
Example
The following install script will install Decode GA4, run the transformation and export all transformed data to Google Cloud Storage:
DECLARE options JSON;
SET options = JSON '''
{
"ga4_dataset_id": "project_id.ga4_dataset_name",
"transform_config_template": "events_external",
"gcs_bucket_name": "bucketname"
}
''';
EXECUTE IMMEDIATE (
SELECT `project_id.decode_ga4_europe_west2.deploy_installer`(options)
);
CALL `project_id.ga4_dataset_name.install_decode_ga4`();
CALL `project_id.decode_ga4_dataset_name.RUN`(NULL);
Note that you will have to replace project_id and ga4_dataset_name in the options and function calls with your actual values.