Skip to content

Instantly share code, notes, and snippets.

@amratab
Last active January 27, 2020 05:22
Show Gist options
  • Save amratab/6884e7b33d408f973032247d8d7edec9 to your computer and use it in GitHub Desktop.
Save amratab/6884e7b33d408f973032247d8d7edec9 to your computer and use it in GitHub Desktop.
Adwords controls metrics for a normal adwords account.
for adwords, first setup a MCC/adwords manager account -- https://adwords.google.com/home/tools/manager-accounts/
Add the client account in this one using https://support.google.com/adwords/answer/6139186?hl=en#link
From the MCC account, create a developer token and apply for a basic token...its easy...not much required...
Now, for the development part
Use this library: https://github.com/googleads/google-api-ads-ruby/tree/master/adwords_api
Use this wiki: https://github.com/googleads/google-api-ads-ruby/wiki/API-access-using-own-credentials-%28installed-application-flow%29
Create OAuth2 credentials for the client account(NOT THE MCC ACCOUNT) using https://developers.google.com/adwords/api/docs/guides/authentication#installed
and running setup_auth2.rb
Run and get results.
For testing:
Testing cannot be done on production client
So, create a test MCC account using your production MCC account:
https://developers.google.com/adwords/api/docs/guides/accounts-overview#getting_started_with_test_accounts
Step 1: Create a new gmail account for test mcc account and using the above link, create test MCC account.
Step 2: Using your production manager account, you must first create a test manager account prior to creating test client accounts.
Step 3: Create client accounts under the test manager account and they will be automatically marked as test accounts.
Step 4: Use the developer token generated in non test MCC account to query
Step 5: Ensure you are logged in as the test MCC account(not client account) when generating oauth2 credentials using developer console.
For production:
Run setup_oauth2.rb again using the oauth2 credentials for production client account and you are good to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment