简体   繁体   中英

Google Ads API Integration

The Company I work with has many clients who uses Google Ads to do marketing for their websites. The company wants to use client's data for Analysis. I am given a project to integrate Google Ads API using C# to get all the data such as Campaigns etc from Google ads and move it to our system for each client. I am only given developer token and customerID for Clients. such as

  1. Customer ID for Client A
  2. Customer ID for Client B

I am bit lost when I went through the google ads API documentation. In the documentation, the OAuth2.0 needs creating in order to use client library which would generate client ID and Client Secret, Refresh token to integrate the API. My question is. Do I need to create OAuth2.0 for each client or do I need to ask my company to generate Client ID and secret in company's Manager Account or Client that uses Google ads would provide me these?

The following Link I found to create OAuth2.

https://developers.google.com/google-ads/api/docs/oauth/cloud-project

This is what I believe would require in C#在此处输入图像描述 Content can be found at https://developers.google.com/adwords/api/docs/guides/first-api-call#.net_1

Would highly appreciate if any one can help me what actually I need to configure google ads using C#

If your company manager account is a manager for the relevant client accounts, you would just need to authenticate as the manager account using your developer token, client id and secret. This gives access to the Ads data for all clients linked under the manager account.

Eg calling Google Ads API CustomerService > ListAccessibleCustomers returns a list of customers accessible to the authenticated client.

Further to comments where you say you will be creating a console app:

The link in your question says use a desktop application if:

You're managing all of your Google Ads accounts using a single top level manager account. You're a first-time user, or want to get started quickly with the simplest setup. Your app will only authenticate Google users from one machine.

So using a manager account which links the required client accounts would be required in this case. See OAuth desktop application flow .

If you used a web application, the clients could log in and your app could read and store their refresh token in a database to make future calls to the api for their account.

You only need to create one application in the Google Console and have one Client ID and Client Secret for it.

Using that one set of credentials, you can go through the OAuth flow with each user to get an access token and refresh token for each of them. The access token, along with your Developer Token, will give you access to AdWords APIs for the user that granted it to you.

You need both your Developer Token and your user's Access Token in order to access the AdWords API.

If you're not as familiar with OAuth, you may look at a managed provider like Xkit (where I work). They have step-by-step instructions for accessing the Google AdWords API including how to generate the credentials and how to use them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM