{"id":14242941,"url":"https://github.com/kritzware/google-ads-go","last_synced_at":"2025-05-06T20:23:04.856Z","repository":{"id":42560156,"uuid":"150163428","full_name":"kritzware/google-ads-go","owner":"kritzware","description":"Google Ads API client library for Golang","archived":false,"fork":false,"pushed_at":"2021-12-15T07:57:21.000Z","size":6042,"stargazers_count":24,"open_issues_count":4,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T10:16:38.606Z","etag":null,"topics":["adwords","go","golang","google","google-ads"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kritzware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-24T20:20:30.000Z","updated_at":"2024-09-20T02:53:03.000Z","dependencies_parsed_at":"2022-08-30T17:22:23.595Z","dependency_job_id":null,"html_url":"https://github.com/kritzware/google-ads-go","commit_stats":null,"previous_names":["opteo/google-ads-go"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kritzware%2Fgoogle-ads-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kritzware%2Fgoogle-ads-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kritzware%2Fgoogle-ads-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kritzware%2Fgoogle-ads-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kritzware","download_url":"https://codeload.github.com/kritzware/google-ads-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252762113,"owners_count":21800265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adwords","go","golang","google","google-ads"],"created_at":"2024-08-21T13:00:51.842Z","updated_at":"2025-05-06T20:23:04.833Z","avatar_url":"https://github.com/kritzware.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# google-ads-go\n\n| Google Ads API version \t| [`v0_7_0`](https://developers.google.com/google-ads/api/docs/release-notes#070_2019-01-30) |\n|-|:-:|\n| Build | [![CircleCI](https://circleci.com/gh/kritzware/google-ads-go.svg?style=shield)](https://circleci.com/gh/kritzware/google-ads-go) |\n| Release | ![Release](https://img.shields.io/github/release/kritzware/google-ads-go.svg) |\n\n## Features\n- Fully matches the latest [Google Ads API Reference](https://developers.google.com/google-ads/api/reference/rpc/)\n- Implemented via [gRPC](https://grpc.io/) with [Protocol Buffers](https://developers.google.com/protocol-buffers/)\n- CLI utils and API for generating and refreshing Google Ads credentials\n\n## Installation\nTo install, simply run:\n```bash\n$ go get -d github.com/kritzware/google-ads-go\n```\nMake sure your PATH includes the $GOPATH/bin directory if you want to use the [CLI utils](https://github.com/kritzware/google-ads-go#cli):\n```bash\nexport PATH=$PATH:$GOPATH/bin\n````\n\n## Example\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/kritzware/google-ads-go/ads\"\n  \"github.com/kritzware/google-ads-go/services\"\n)\n\nfunc main() {\n  // Create a client from credentials file\n  client, err := ads.NewClientFromStorage(\"google-ads.json\")\n  if err != nil {\n    panic(err)\n  }\n  \n  // Load the \"GoogleAds\" service\n  googleAdsService := services.NewGoogleAdsServiceClient(client.Conn())\n  \n  // Create a search request\n  request := services.SearchGoogleAdsRequest{\n    CustomerId: \"2984242032\",\n    Query:      \"SELECT campaign.id, campaign.name FROM campaign ORDER BY campaign.id\",\n  }\n  \n  // Get the results\n  response, err := googleAdsService.Search(client.Context(), \u0026request)\n  for _, row := range response.Results {\n    campaign := row.Campaign\n    fmt.Printf(\"id: %d, name: %s\\n\", campaign.Id.Value, campaign.Name.Value)\n  }\n}\n```\n\nWhen using the `NewGoogleAdsClientFromStorage` method, you must provide a path to a valid `google-ads.json` file (containing your Google Ads API credentials).\n```json\n{\n    \"client_id\": \"YOUR_CLIENT_ID\",\n    \"client_secret\": \"YOUR_CLIENT_SECRET\",\n    \"refresh_token\": \"YOUR_REFRESH_TOKEN\",\n    \"developer_token\": \"YOUR_DEVELOPER_TOKEN\"\n}\n\n```\n\n## CLI\nThis library also provides some CLI utilities for generating/refreshing Google OAuth2 credentials. The newly generated token will be printed to stdout, as well as the expiry timestamp.\n#### Generate Access Token from Refresh token\n```bash\n$ gads refresh -client-id CLIENT_ID -client-secret CLIENT_SECRET -refresh-token REFRESH_TOKEN\n```\n#### Generate Access Token from JSON credentials file\n```bash\n$ gads refresh -file credentials.json\n```\nAdditionally, you can use the `-help` flag for more information: `gads refresh --help`\n\n## Contributing\n### Compiling\nAll build scripts use `Makefile`\n\n**Build and run**\n```bash\n$ make run\n```\n\n**Run with gRPC debugging output**\n```bash\n$ make run-debug\n```\n\n## Changelog\nTo see the changes between Google Ads API versions, take a look at the official [Google Ads API Release Notes](https://developers.google.com/google-ads/api/docs/release-notes).\n\n### Manually Building Protos\nBuilding `.pb.go` files from the original `googleads` protos should only be done when updating to a new Google Ads version.\n\nRequirements:\n- [protoc](https://github.com/protocolbuffers/protobuf)\n\nBuild `.pb.go` protos:\n```bash\n$ make protos\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkritzware%2Fgoogle-ads-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkritzware%2Fgoogle-ads-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkritzware%2Fgoogle-ads-go/lists"}