Google Analytics is a service for web analytics that tracks and provides data regarding user engagement with your website or application.
Service account credentials are more suitable for server-to-server interactions.
To obtain API credentials using a GCP service account, follow these steps:
Note: For service account authentication, use the
client_email
.
The config
section in a YAML file includes the following properties:
Connectorname: Google_analytics
project_id: ID of the project
client_email: Email of the client
private_key: Private key
For Service Account :
version: 1.0.1
encrypt_credentials: false
direct_target_import: false
union_all_tables: true
add_dbname_column: false
direct_load_to_destination: true
plugins:
extractors:
- name: <NAME>
connectorname: Google Analytics
config:
project_id: <PROJECT ID>
client_email: <CLIENT EMAIL>
private_key: <PRIVATE KEY>
type: Service
properties:
property_id: <PROPERTY ID>
queries: "[{'resource_name':'sample_analytics_data1','dimensions':['browser','city'],'metrics':['totalUsers','transactions']},{'resource_name':'sample_analytics_data2','dimensions':['browser','city','dateHour'],'metrics':['totalUsers']}]"
start_date: <START DATE>
For OAuth Account :
version: 1.0.1
encrypt_credentials: false
direct_target_import: false
union_all_tables: true
add_dbname_column: false
direct_load_to_destination: true
plugins:
extractors:
- name: <NAME>
connectorname: Google Analytics
config:
project_id: <PROJECT ID>
client_id: <CLIENT ID>
client_secret: <CLIENT SECRET>
type: OAuth
properties:
property_id: <PROPERTY ID>
queries: "[{'resource_name':'sample_analytics_data1','dimensions':['browser','city'],'metrics':['totalUsers','transactions']},{'resource_name':'sample_analytics_data2','dimensions':['browser','city','dateHour'],'metrics':['totalUsers']}]"
start_date: <START DATE>
Click on Allow in the authorization window to accept the scopes requested by Bold DataHub.
Update the project ID, client ID and client secret in the template. Also, Update the resources on the properties
property and Click Save and choose the desired destination to save the pipeline.
Bold Data Hub
icon on the Navigation Pane.Add Project
and provide the name for the new project.Google Analytics
template.properties
property and save it to the BoldBI Data Store.Warning:
1. The `Encrypt_Credentials` property should be set to false when updating the new access token on the template. If you have modified other properties, such as 'select' or 'account id', the `Encrypt_Credentials` property must be set to true.
2. The default lifetime of the access token is 1 hour. Therefore, you need to convert it to a long-lived access token in order to use the same token for 60 days. Existing tables should be maintained even if the token has expired or is being used as an invalid token.
Run Now
button..
Edit DataSource
Option to view the created tables.