Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Numbered Headings
start-numbering-ath5

Before setting up the connector, install the most current TD Toolbelt.
Please refer to this page to generate credentials on the Google side. Please make sure to choose Google Ads API in step 1 Select & authorize APIs step in OAuth 2.0 playground.

Create Seed Configuration File (seed.yml)

Excerpt
hiddentrue

The following is an AWS example to prepare a seed.yml file. Replace the code with the correct code for your <product>.

Unable custom query

Code Block
linenumberstrue
in:   
  type: google_ads_v2
  enable_custom_query: false
  client_id: xxx
  client_secret: xxx
  refresh_token: xxx
  client_customer_id: xx-xxxx-xxxx
  target: AD_PERFORMANCE_REPORT
  date_range: "CUSTOM_DATE"
  include_predefined_metrics: false
  developer_token: xxx
  incremental: true
  start_date: 2020-03-01
  end_date: 2020-03-02
  segments: ["segments.date"]
  metrics: ["metrics.absolute_top_impression_percentage"] 
out:
  mode: append


Enable custom query

Code Block
linenumberstrue
in:   
  type: google_ads_v2
  enable_custom_query: true
  client_id: xxx
  client_secret: xxx
  refresh_token: xxx
  client_customer_id: xx-xxxx-xxxx
  date_range: "CUSTOM_DATE"
  developer_token: xxx
  incremental: true
  start_date: 2020-03-01
  end_date: 2020-03-02
  select_columns: ad_group_criterion.criterion_id, ad_group.id, ad_group.name, segments.date
  from_target: keyword_view
  other_conditions: "AND ad_group_criterion.type = 'KEYWORD'"
out:
  mode: append

Parameters Reference

NameDescriptionValueDefault ValueRequired
client_customer_idClient customer IDString
True
targetReport typeString
True
segmentsList of additional segmentsArray of String
False
metricsList of additional metricsArray of String
False
attributesList of additional attributesArray of String
False
date_rangeDate range typeString
True
include_zero_impressionsFilter the records by impressionBooleanTrueFalse
include_predefined_metricsInclude all predefined metricsBooleanTrueFalse
incrementalRun the job in incremental modeBooleanFalseFalse
start_dateStart date, used with `date_range` is `custom_date`Date
False
end_dateEnd date, used with `date_range` is `custom_date`Date
False
include_negative_keywordsFilter the records by negative keywords, only used with keywords_performance_reportFalseFalseFalse
refresh_tokenRefresh tokenString
True
client_idClient IDString
True
client_secretClient SecretString
True
developer_tokenDeveloper TokenString

enable_custom_queryEnable to use the custom query BooleanFalseTrue
select_columnsList of fields to query, separated by commaString
False
from_targetReport target nameString
False
other_conditionsThe other condition of the queryString
False

The data connector imports all files that match the specified prefix. 

Example

path_prefix: path/to/sample_ –> path/to/sample_201501.csv.gz, path/to/sample_201502.csv.gz, …, path/to/sample_201505.csv.gz

Generate load.yml

Use connector:guess. This command automatically reads the source files and uses logic to guess the file format and its field/columns.

Code Block
linenumberstrue
$ td connector:guess seed.yml -o load.yml

You can open the load.yml to review the file format definitions including file formats, encodings, column names, and types.

Example

Disable custom query

Code Block
linenumberstrue
in:   
  type: google_ads_v2
  enable_custom_query: false
  client_id: xxx
  client_secret: xxx
  refresh_token: xxx
  client_customer_id: xx-xxxx-xxxx
  target: AD_PERFORMANCE_REPORT
  date_range: "CUSTOM_DATE"
  include_predefined_metrics: false
  developer_token: xxx
  incremental: true
  start_date: 2020-03-01
  end_date: 2020-03-02
  segments: ["segments.date"]
  metrics: ["metrics.absolute_top_impression_percentage"] 
out:
  mode: append


Enable custom query

Code Block
linenumberstrue
in:   
  type: google_ads_v2
  enable_custom_query: true
  client_id: xxx
  client_secret: xxx
  refresh_token: xxx
  client_customer_id: xx-xxxx-xxxx
  date_range: "CUSTOM_DATE"
  developer_token: xxx
  incremental: true
  start_date: 2020-03-01
  end_date: 2020-03-02
  select_columns: ad_group_criterion.criterion_id, ad_group.id, ad_group.name, segments.date
  from_target: keyword_view
  other_conditions: "AND ad_group_criterion.type = 'KEYWORD'"
out:
  mode: append


To preview the data, use the td connector:preview command.


Code Block
linenumberstrue
$ td connector:preview load.yml
+-------+---------+----------+---------------------+
| id    | company | customer | created_at          |
+-------+---------+----------+---------------------+
| 11200 | AA Inc. |    David | 2015-03-31 06:12:37 |
| 20313 | BB Imc. |      Tom | 2015-04-01 01:00:07 |
| 32132 | CC Inc. | Fernando | 2015-04-01 10:33:41 |
| 40133 | DD Inc. |    Cesar | 2015-04-02 05:12:32 |
| 93133 | EE Inc. |     Jake | 2015-04-02 14:11:13 |
+-------+---------+----------+---------------------+


...