How to Integrate Google Ads API in .Net

MODIFIED ON : February 14, 2020 / ALIGNMINDS TECHNOLOGIES / 0 COMMENTS
How to integrate Google Adwords API in .net

First, let’s take a look at how Google Ads work –

Google Ads in action:

Google Ads (formerly Google AdWords) in action

You might see the Ads with the top row results in the Google search. What are they, why they differ from the other results?

Those are Google ads that a company paid for so that people will notice their business whenever they’re searching Google. And, the company only have to pay whenever someone clicks on the ad. This is known as cost-per-click advertising (CPC).

How to show your Ads on Google

Go to  http://tinyurl.com/pevnb3j and create your own Google ads account. Then you can create your Ads with your preferred locations, keywords, etc. For help on creating managing your Google ads account go to http://tinyurl.com/qy6kuq7

Google ads API

The Google ads API allows applications to interact directly with the Google ads platform. You can build applications to more efficiently manage large or complex Google ads accounts. If you want to use Google ads API in your applications, first you will have to create an MCC account.

What is an MCC account?

MCC (My Client Center) Account

An MCC account -manager account- is a Google ads account that lets you easily view and manage multiple Google ads accounts –including other manager accounts– from a single location.

What is an MCC account
You can create a new MCC account here – http://tinyurl.com/q9n7gsh

Learn more about MCC accounts here – http://tinyurl.com/q9f8tv8

The following information should be submitted for making Google ads API calls,

  1. Developer Token,
  2. Client Customer ID,
  3. oAuth2 Client ID,
  4. oAuth2 Client Secret,
  5. oAuth2 Refresh Token.

Where do you find all these?

Developer Token

After creating your MCC account successfully, you can see your Developer Token here http://tinyurl.com/pov4xwa

  • Client Customer ID

Client Customer Id is your Google ads account ID. You can see this on the right-top position in the MCC or Google ads website.

Google Ads customer ID
  • oAuth2 Client ID & oAuth2 Client Secret

Do you already have an account in Google developer console? If yes you can see this information here – http://tinyurl.com/qcunww3

New to Google developer console? learn how to use and manage it here – http://tinyurl.com/kl2vqxo

  • oAuth2 Refresh Token

You can download the Adwords API libraries with examples in this link – http://tinyurl.com/nntrpyu.

After downloading go to the following path? “..\utilities\OAuthTokenGenerator\bin\Debug\”. There you can see a file named ‘OauthTokenGenerator.exe’. Run the file and you will get the following screen:

Submit Client ID and Client Secret you have handy then click OK, and it will show you the Refresh Token for your account.

Like to know more about Refresh Token? Go to – http://tinyurl.com/noqeloa

Sample Code

Following is a sample code for creating a new AdWords account in our MCC account,

Sample code Google Ads integration

Download “Google.Adwords.dll” and “Google.Ads.Common.dll” from http://tinyurl.com/nntrpyu

Find the .dll files inside – ..\examples\AdWords\CSharp\bin\Debug\”.

Please note: You can use the Developer Token only after your MCC account is verified by Google Team. This process is done by humans and it needs long time so. (sometimes it takes more than two months!)

Want to start coding right away?

MCC test Accounts comes for help.

MCC Test Account

MCC test accounts allow developers to execute AdWords API requests against the production environment for development and testing purposes. The MCC Test Account will not server the Ads on real Google search.

MCC Test account
You can see a “This is a test account!” label on the right-top side of your MCC website.

You must use a production (non-test) MCC account’s developer token to make AdWords API calls against a test account. You can use the production developer token against a test account even when the production developer token is pending approval.

Google Ads API call MCC account

You can create a new MCC Test Account here – http://tinyurl.com/nqlaymn

Download AdWords API libraries and sample codes from here – http://tinyurl.com/nntrpyu

– Anver Ali

Leave a Reply
Your email address will not be published.