THIS IS NOT READY FOR PRODUCTION. Bearer tokens sometimes slip out to logs. Use at your own Peril :D
_sdc_primary_key
is added to each stream in order to give a primary_key because google's api has nested data that doesn't play nicely without a top level primary key, so we copy the data needed for a primary key to this made up field. All other fields match the api response.
catalog
discover
about
stream-maps
Setting | Required | Default | Description |
---|---|---|---|
client_id | True | None | ClientID from Oauth Setup |
client_secret | True | None | ClientSecret from Oauth Setup |
developer_token | True | None | Developer Token from Google Ads Console |
refresh_token | True | None | Refresh Token from Oauth dance |
customer_id | True | None | Customer ID from Google Ads Console, note this should be the top level client. This tap will pull all subaccounts |
login_customer_id | True | None | Customer ID that has access to the customer_id, note that they can be the same, but they don't have to be as this could be a Manager account |
start_date | True | 2022-03-24T00:00:00Z (Today-7d) | Date to start our search from, applies to Streams where there is a filter date. Note that Google responds to Data in buckets of 1 Day increments |
end_date | True | 2022-03-31T00:00:00Z (Today) | Date to end our search on, applies to Streams where there is a filter date. Note that the query is BETWEEN start_date AND end_date |
Get a developer token, client id, and client secret as recommended in the Google Ads API documentation. Then do the following:
-
Modify following template url and put it in a browser. Then follow the prompts to authenticate.
GET https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id={client_id}&redirect_uri=http://127.0.0.1&scope=https://www.googleapis.com/auth/adwords&access_type=offline&prompt=select_account&include_granted_scopes=true
-
Modify the following url with the value in the
code
parameter that was returned in the previous browser url bar. Replace all other templated values and submit aPOST
request:https://www.googleapis.com/oauth2/v4/token?code={code}&client_id={client_id}&client_secret={client_secret}&redirect_uri=http://127.0.0.1&grant_type=authorization_code
-
From the response you can grab the
refresh_token
and use it as is. Sometimes the following step is also required. -
(IF NECESSARY) Modify the following templated url as suggested and submit a POST request.
https://www.googleapis.com/oauth2/v4/token?refresh_token={refres_token}&client_id={client_id}&client_secret={client_secret]&grant_type=refresh_token
A full list of supported settings and capabilities for this tap is available by running:
tap-googleads --about
You can easily run tap-googleads
by itself or in a pipeline using Meltano.
tap-googleads --version
tap-googleads --help
tap-googleads --config CONFIG --discover > ./catalog.json
-
Developer TODO:
As a first step, scan the entire project for the text "TODO:
" and complete any recommended steps, deleting the "TODO" references once completed.
pipx install poetry
poetry install
Create tests within the tap_googleads/tests
subfolder and
then run:
poetry run pytest
You can also test the tap-googleads
CLI interface directly using poetry run
:
poetry run tap-googleads --help
Testing with Meltano
Note: This tap will work in any Singer environment and does not require Meltano. Examples here are for convenience and to streamline end-to-end orchestration scenarios.
Your project comes with a custom meltano.yml
project file already created. Open the meltano.yml
and follow any "TODO" items listed in
the file.
Next, install Meltano (if you haven't already) and any needed plugins:
# Install meltano
pipx install meltano
# Initialize meltano within this directory
cd tap-googleads
meltano install
Now you can test and orchestrate using Meltano:
# Test invocation:
meltano invoke tap-googleads --version
# OR run a test `elt` pipeline:
meltano elt tap-googleads target-jsonl
See the dev guide for more instructions on how to use the SDK to develop your own taps and targets.
Built with the Meltano SDK for Singer Taps and Targets.