Google Campaign Keywords Data in Salesforce

Google AdWords provides you with a unique ID, called a “GCLID,” for every click that comes to your website from an AdWords ad. By querying you’ll be able to see which keywords (Search String) are contributing not just to new lead submissions, but, more importantly, to actual sales.

How to Retrieve Keywords

Step 1:

You need to have an AdWords manager account to apply for access to the API. If you don’t already have a manager account, you will need to create one.

For Create a new Manager Account follow the link.

Step 2:

Adwords API access:

For Adwords API access we need to submit the details, after logging in to your manager account:

Go to Gear Icon Account Settings- Adwords API Center.

gclid adwords salesforce


1) Make sure your information is correct and your company’s website URL is functioning. If the website is not a live page, google will not be able to process your application.

2) Google will initially contact you within two business days of the date you submitted your application. In the meantime, you can try out the API with Test Account.

Step 3:

After completing Step 2, a link to a follow-up application form will be sent from to the email address listed in the AdWords API Centre. Please complete this follow-up form to continue your application. We need to take approval of our developer token for interacting with the google system.

Token Review Team

Your assigned developer token will be activated once your application for API access is approved. Your token will be available through your AdWords API Centre accessible through the Account settings menu for the manager account from which you applied. You’ll be able to access the API by including it in your request headers when interacting with google system.

Note: You can use the Production developer token against a Test account even when the production developer token is pending approval. While making Adwords API calls.

What is Test Account?

AdWords test accounts allow developers to execute AdWords API requests against the production environment for development and testing purposes.

Note: You cannot link test MCC or Adwords accounts to production MCC accounts, or vice versa.

How to Use Test Account for Retrieve Data

For test account, you need to first create a Test MCC account. For a test account, you must have an existing Google account that is not already linked to an AdWords account (either Production MCC or Test MCC). If you don’t have you can create a new Google account at

Follow the link for Test Account:

All client accounts created under this test MCC account will be automatically marked as test accounts. (We need Client Customer id as a request header).

Go to  Left Panel Accounts  then Click on +Account  New Adwords Account

It will create a client account and there you can find Client Customer Id also.

Prior to making AdWords API requests to a test account, make sure you also have a production (non-test) MCC account and a production developer token (either pending approval or approved will work).

Prerequisites for Adwords API Calls

For make Calls against the AdWords API require two pieces of information

A) An approved Developer Token if it is a Production account, for Test account no need of approved one.

B) Credentials that allow access to the targeted account (OAuth2.0).

 Developer Token: It is automatically generated for you when you create an account. To access it.

Go to Gear Icon Account Settings Adwords API Center.

Credentials: Each request to the AdWords API must be authorized to make changes or retrieve data for an AdWords account.

To use OAuth 2.0 to authorize the AdWords API, We need to exchange Token for authentication for this we need to send a request to

Method  –> Post.

google adwords salesforce gclid


Redirect_uri =


For Authorization Code

Paste the following URL in your browser after fill the client_id. client id&response_type=code&

You will then see a screen to grant your application access to your AdWords data:

gclid adwords salesforce

After you accept the request, you will get an authorization code that can be exchanged for an access token.

google adwords salesforce gclid

For Client Id and Secret

You must first create a client identifier and a client secret.

Step 1: Register your application and create a Client Id. Then google will provide you Client Id and Client Secret. Which are useful for authentication.

For Client Id we need to create Project

Step 2: From top left corner click on Select Project –> Create Project:

Google Adwords Salesforce GCLID

Enter the Project Name then click on Create. You can also observe Project Id here.

After Successful creation it will open then

Go to  API & Auth  Credentials.

Step 3:  It prompt window choose OAuth 2.0 Client Id.

Google Adwords Salesforce GCLID

Step 4: Make sure all of the required fields are filled and saved for the Consent Screen. Choose any name for Product.

gclid adwords salesforce

Step 5: Select type of Application and give Redirect Url as:
google adwords salesforce gclid

Client ID and Client secret will be created and displayed.

Use these details for make request. If you’ve made a proper request, Google will return your OAuth2 token. The access token is what you need when sending requests to AdWords API services

Example: Report download.

Pull keyword data into Salesforce using the gclid (Google Click Id)

For pull keyword data we need to go for Report download API and report type is CLICK_PERFORMANCE_REPORT.

Use this API for get Keyword information:

Method: POST

Request headers:

Authorization: Bearer YOUR_ACCESS_TOKEN (Which is generated in Earlier Request)

DeveloperToken: YOUR_Developer_TOKEN(22 character)

clientCusomerId: xxx xxx xxxx

Sample Request Body is:

__rdquery=SELECT+CriteriaId+FROM+CLICK_PERFORMANCE_REPORT+WHERE GclId=1234+DURING+20150901,20150901&__fmt=CSV

__rdquery“: contains the AWQL query string.

__fmt“: defines the report download format either CSV OR XM

Posted in Salesforce, salesforce consultant. Tagged with , .

Leave a Reply

Your email address will not be published. Required fields are marked *