Skip to content

Commit

Permalink
revert GA and target s3 incorrect changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 committed Oct 18, 2023
1 parent 6ee45d9 commit 8118352
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 375 deletions.
141 changes: 107 additions & 34 deletions _data/meltano/extractors/tap-google-analytics/meltanolabs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ capabilities:
- schema-flattening
- state
- stream-maps
description: App and website analytics platform hosted by Google (GA4)
domain_url: https://developers.google.com/analytics/devguides/reporting/data/v1
executable: tap-google-analytics
description: App and website analytics platform hosted by Google
domain_url: https://developers.google.com/analytics/devguides/reporting/core/v4/
keywords:
- api
- meltano_sdk
label: Google Analytics (GA4)
logo_url: /assets/logos/extractors/ga4.png
label: Google Analytics (Universal Analytics API - Deprecated)
logo_url: /assets/logos/extractors/google-analytics.png
maintenance_status: active
name: tap-ga4
namespace: tap_ga4
next_steps: ''
pip_url: git+https://github.com/MeltanoLabs/tap-google-analytics.git
name: tap-google-analytics
namespace: tap_google_analytics
pip_url: git+https://github.com/MeltanoLabs/tap-google-analytics.git@main_deprecated_ua
quality: gold
repo: https://github.com/MeltanoLabs/tap-google-analytics
settings:
- description: Google Analytics Client Secrets Dictionary
- description: |
Follow the above steps for [Key File Location](#key-file-location) but instead of providing a path you can provide the serialized json directly. This can be useful for ephemeral runtime environments where its easier to provide an environment variable instead of a file.
kind: object
label: Client Secrets
name: client_secrets
placeholder: Ex. client_secrets.json
- description: Date up to when historical data will be extracted.
kind: date_iso8601
label: End Date
Expand All @@ -38,17 +38,77 @@ settings:
kind: integer
label: Flattening Max Depth
name: flattening_max_depth
- description: File Path to Google Analytics Client Secrets
- description: |
#### How to get
Follow the steps below if you don't already have a valid `client_secrets.json` to upload. The process below can take over 10 minutes, but it's a one-time setup that's well worth it.
This extractor supports service account based authorization, where an administrator manually creates a service account with the appropriate permissions to view the account, property, and view you wish to fetch data from.
To access your Google Analytics data, the "Analytics Reporting API" and "Analytics API" both need to be enabled. These need to be enabled for a project inside the same organization as your Google Analytics account.
##### Step 1: Creating Service Account Credentials
As a first step, you need to create a new project in Google Cloud Platform or use an existing one:
1. Sign in to the Google Account you are using for managing Google Analytics (you must have Manage Users permission at the account, property, or view level).
2. Open the [Service accounts page](https://console.developers.google.com/iam-admin/serviceaccounts). If prompted, select a project or create a new one to use for accessing Google Analytics.
![Screenshot of Google Service Accounts page](/assets/images/tap-google-analytics/02-ga-service-account-configuration-create-new-account.png)
3. Click "Create service account"
In the Create service account window, type a name for the service account, and click `Create`.
We do not need to provide any additional permissions for this account, so click `Continue` in the `Service account permissions` configuration page.
We also do not need to grant access to any users for this service account, as we only need the key.
![Screenshot of Google Service Account Configuration for new Account](/assets/images/tap-google-analytics/02-ga-service-account-configuration-new-account.png)
Click `Create Key`, select `JSON` as the key type and create a new private key. Then click `Save` and store it locally as `client_secrets.json`.
Meltano will use the private key in this `client_secrets.json` file to connect with the Google Analytics API.
##### Step 2: Linking Credentials to Google Analytics
The newly created service account will have an email address that looks similar to:
```
[email protected]
```
To grant this service account access to your Google Analytics data, add the email address as a [new user](https://support.google.com/analytics/answer/1009702) to your Google Analytics account, property or view through the "Admin > User Management" page.
Only the [Read & Analyze permissions](https://support.google.com/analytics/answer/2884495) are needed as Meltano only extracts data to generate reports.
![Screenshot of Google Analytics Add User](/assets/images/tap-google-analytics/03-ga-add-user.png)
##### Step 3: Enabling the APIs
1. Visit the [Google Analytics Reporting API](https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/overview) dashboard and make sure that the project you used in the previous step is selected.
Now enable the API using the button at the top, so that the button will say "Disable API" instead:
![Screenshot of Google Analytics Reporting API](/assets/images/tap-google-analytics/04-ga-reporting-api.png)
2. Next, visit the [Google Analytics API](https://console.developers.google.com/apis/api/analytics.googleapis.com/overview) dashboard, make sure that the project you used in the previous step is selected, and enable this API as well.
![Screenshot of Google Analytics API](/assets/images/tap-google-analytics/05-ga-api.png)
kind: password
label: Key File Location
name: key_file_location
placeholder: Ex. $MELTANO_PROJECT_ROOT/client_secrets.json
- description: Google Analytics Access Token. See
https://developers.google.com/analytics/devguides/reporting/core/v4/authorization#OAuth2Authorizing.
kind: password
label: OAuth Credentials Access Token
name: oauth_credentials.access_token
- description: Google Analytics Client ID. See
https://developers.google.com/analytics/devguides/reporting/core/v4/authorization#OAuth2Authorizing.
- description: |
See <https://developers.google.com/analytics/devguides/reporting/core/v4/authorization#OAuth2Authorizing>.
Takes precedence over [Key File Location](#key-file-location) if both are specified.
kind: password
label: OAuth Credentials Client ID
name: oauth_credentials.client_id
Expand All @@ -63,12 +123,9 @@ settings:
label: OAuth Credentials Refresh Token
name: oauth_credentials.refresh_token
- description: |
Google Analytics Reports Definition.
The tap uses the [default reports definition](https://github.com/MeltanoLabs/tap-google-analytics/blob/main/tap_google_analytics/defaults/default_report_definition.json)
if this field is not provided.
A project-relative path to JSON file with the definition of the reports to be generated.
Project-relative path to JSON file with the definition of the reports to be generated.
See <https://ga-dev-tools.google/ga4/dimensions-metrics-explorer/> for valid dimensions and metrics.
See <https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/> for valid dimensions and metrics.
The JSON structure expected is as follows:
Expand Down Expand Up @@ -99,25 +156,25 @@ settings:
{ "name" : "users_per_day",
"dimensions" :
[
"date"
"ga:date"
],
"metrics" :
[
"newUsers",
"active1DayUsers"
"ga:users",
"ga:newUsers"
]
},
{ "name" : "sessions_per_country_day",
"dimensions" :
[
"date",
"country"
"ga:date",
"ga:country"
],
"metrics" :
[
"sessions",
"sessionsPerUser",
"avgSessionDuration"
"ga:sessions",
"ga:sessionsPerUser",
"ga:avgSessionDuration"
]
}
]
Expand All @@ -141,23 +198,39 @@ settings:
kind: object
label: Stream Maps
name: stream_maps
- description: Google Analytics View ID
- description: |
The ID for the view to fetch data from.
#### How to get
To get your View ID:
1. Visit Google Analytics: <https://analytics.google.com/>
2. Log in if you haven't already.
3. Open the account/property/view selector in the top left corner
![Screenshot of closed account selector](/assets/images/tap-google-analytics/account-selector-closed.png)
3. Select the account, property, and view that you would like to connect with Meltano
![Screenshot of open account selector](/assets/images/tap-google-analytics/account-selector-open.png)
4. You will see the View ID displayed inside the selector below the name of the view (e.g. "All Web Site Data"): `188274549`
kind: password
label: View ID
name: view_id
placeholder: Ex. 198343027
settings_group_validation:
- - client_secrets
- property_id
- start_date
- - key_file_location
- property_id
- start_date
- view_id
- - client_secrets
- start_date
- view_id
- - oauth_credentials.access_token
- oauth_credentials.client_id
- oauth_credentials.client_secret
- oauth_credentials.refresh_token
- property_id
- start_date
settings_preamble: ''
usage: ''
- view_id
variant: meltanolabs
Loading

0 comments on commit 8118352

Please sign in to comment.