THIS IS A FORKED REPO FROM https://github.com/google/analytics-settings-database
Deploy script modified to set all relevant locations to EU and updated the BQ Schema
This is not an officially supported Google product.
This repository contains code for a Google Cloud Function that loads Universal Google Analytics and Google Analytics 4 settings into a set of BigQuery tables. By default, the function is scheduled to run daily. This creates a daily backup of Google Analytics settings that can be used for a variety of purposes, including restoring settings, auditing setups, and having an extensive change history across accounts.
- Google Cloud Platform (GCP) project with billing enabled - Create or use an existing project as needed.
- Note: This solution uses billable GCP resources.
- Google Analytics
- Navigate to your Google Cloud project and open Cloud Shell
- Enter the following into Cloud Shell:
For location US:
rm -rf analytics-settings-database && git clone https://github.com/google/analytics-settings-database.git && cd analytics-settings-database && bash deploy.sh
For location EU:
rm -rf analytics-settings-database && git clone https://github.com/google/analytics-settings-database.git && cd analytics-settings-database && bash deploy_eu.sh
- Enter the information when prompted during the deployment process. When asked if unauthenticated invocations should be allowed for the Cloud Function, answer no.
- This will create the following:
- A Cloud Function
- A Cloud Storage Bucket
- A Cloud Scheduler Job
- A BigQuery dataset with the name “analytics_settings_database”
- The following tables:
- ga4_account_summaries
- ga4_accounts
- ga4_android_app_data_streams
- ga4_conversion_events
- ga4_custom_dimensions
- ga4_custom_metrics
- ga4_dv360_link_proposals
- ga4_dv360_links
- ga4_firebase_links
- ga4_google_ads_links
- ga4_ios_app_data_streams
- ga4_measurement_protocol_secrets
- ga4_properties
- ga4_web_data_streams
- ua_account_summaries
- ua_audiences
- ua_custom_dimensions
- ua_custom_metrics
- ua_filter_links
- ua_filters
- ua_goals
- ua_segments
- ua_views
- Add the service account email generated during the deployment process to your Google Analytics accounts.
Upon completing the implementation process, the settings for your Google Analytics accounts that the API can access will be loaded into BigQuery daily at 11 PM. The frequency with which this happens can be adjusted by modifying the Cloud Scheduler Job created during the deployment process.
This optional table combines several different tables together to quickly see important data related to GA4 properties. The table is set to be updated on a daily basis at 11:30 PM via a scheduled query. The table can be easily connected to a Data Studio dashboard to quickly visualize its data. To create the table and scheduled query, open Cloud Shell and enter the following:
cd analytics-settings-database/health_checkup && bash deploy.sh