Skip to content

sumoheavy/tap-google-ads

 
 

Repository files navigation

tap-google-ads

This is a Singer tap that produces JSON-formatted data following the Singer spec.

This tap:

  • Pulls raw data from Google Ads API v8
  • Extracts the following resources:
    • Campaign with selected segments and metrics that we care about
  • Outputs the schema for each resource
  • Incrementally pulls metrics data based on the input state

Install

pip install git+https://github.com/vibeus/tap-google-ads.git@v0.1.0

Usage

  1. Follow Singer.io Best Practices for setting up separate tap and target virtualenvs to avoid version conflicts.
  2. Create a config file ~/config.json with Google Ads API Credentials.
    {
      "developer_token": "env[DEVELOPER_TOKEN]",
      "client_id": "env[GOOGLE_CLIENT_ID]",
      "client_secret": "env[GOOGLE_CLIENT_SECRET]",
      "refresh_token": "env[GOOGLE_OAUTH_REFRESH_TOKEN]",
      "login_customer_id": "1234567890",
      "customer_ids": ["1234567890"],
      "start_date": "2021-07-01T00:00:00Z"
    }
  3. Discover catalog: tap-google-ads -c config.json -d > catalog.json
  4. Select campaigns and campaign_metrics stream in the generated catalog.json.
    ...
    "stream": "campaigns",
    "metadata": [
      {
        "breadcrumb": [],
        "metadata": {
          "table-key-properties": [
            "resource_name"
          ],
          "forced-replication-method": "FULL_TABLE",
          "valid-replication-keys": [],
          "inclusion": "available",
          "selected": true  <-- Somewhere in the huge catalog file, in stream metadata.
        }
      },
      ...
    ]
    ...
    "stream": "campaign_metrics",
    "metadata": [
      {
        "breadcrumb": [],
        "metadata": {
          "table-key-properties": [
            "campaign_id",
            "ad_network_type",
            "date",
            "device"
          ],
          "forced-replication-method": "INCREMENTAL",
          "valid-replication-keys": [
            "date"
          ],
          "inclusion": "available",
          "selected": true  <-- Somewhere in the huge catalog file, in stream metadata.
        }
      },
      ...
    ]
    ...
    
  5. Use following command to sync all campaigns and their metrics.
tap-google-ads -c config.json --catalog catalog.json > output.txt

Copyright © 2021 Vibe Inc

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%