Import conversions from Salesforce

If you track leads and opportunities in Salesforce’s Sales Cloud®, you can import your offline conversions from Salesforce's Sales Cloud into Google Ads. This will help you better measure how your online Google Ads investments are generating offline value.

In this article, we'll show you how to set up your accounts to import conversions from Salesforce.

This article jumps right to the instructions. If you want to read an overview first, see About Google Ads Conversion Import for Salesforce.

Before you begin

To use this feature, you’ll need to meet the following requirements:

  • Be able to sign in to a Salesforce Sales Cloud account, using a login with appropriate permissions. For the easiest setup, consider using an account with System Administrator permissions, assuming your default access settings haven't been changed. For a detailed list of the required account permissions (that you can forward to your administrator of your Salesforce® account), see the minimum permissions requirements below
  • Have auto-tagging enabled in your Google Ads account(s).
  • Be able to edit your website code. You or your webmaster will have to edit your code to capture the Google click ID (GCLID).
  • Be able to make changes in your Salesforce account, including creating custom fields and enabling field history tracking. (See step 1 below.)
  • Have a click-to-conversion cycle that is less than 90 days. Conversions uploaded more than 90 days after the associated last click will not be imported by Google Ads and will therefore not show up in your conversion statistics.
  • Use Salesforce’s web-to-lead feature, or another solution to transmit lead information from your website to Salesforce.
Salesforce account minimum permissions requirements

Google Ads Conversion Import for Salesforce requires access to the following fields, organized by object.  A user account with System Administrator access may already have access to these fields.

  • Organization: ID, Name, OrganizationType
  • LeadStatus: ID, MasterLabel, SortOrder
  • OpportunityStage: ID, MasterLabel, SortOrder, IsActive
  • LeadHistory: CreatedDate, OldValue, NewValue, Field
  • Lead: Status, GCLID (a custom field you’ll create in the steps below)
  • OpportunityFieldHistory: CreatedDate, OldValue, NewValue, Field
  • Opportunity: Amount, Probability, StageName, GCLID (a custom field you’ll create in the steps below)

If you use Group Edition or Professional Edition, field access is granted by simply adding the necessary fields to your Lead and Opportunity page layouts. To do this, select Setup, then Customize, then Lead (or Opportunity), then Page Layout. Then simply drag the required fields onto the page.

If you don’t want to link your Google Ads and Salesforce account, you can follow the instructions to manually import conversions from Salesforce.

How to set up Google Ads Conversion Import for Salesforce®

Follow the steps below to prepare your Salesforce account, Google Ads account, and website; link your Salesforce and Google Ads accounts; and start importing conversions.

Every business is different: we've included basic instructions here, but you may want to customize your setup based on how you use Salesforce. If someone else manages your Salesforce account, work with them to find the best solution for you.

The new Google Ads experience is now the exclusive way for most users to manage their accounts. If you’re still using the previous AdWords experience, choose Previous below. Learn more

Step 1: Configure your Salesforce account

Before getting started, you’ll want to make sure your Salesforce account is set up in the following way. If someone else manages the Salesforce account for your business, they can help you with this step.

  1. Update the Opportunity object with the following changes:
    1. Create a custom field with the Field Name "GCLID" (in all capital letters, without the quotes). The “Field Label” can be anything you want. Set the field length to 255 characters. Make this field read-only so your users don't accidentally alter it.
    2. Enable field history tracking for the "Stage" field.
  2. Update your Lead object with the following changes:
    1. Create a custom field with the Field Name "GCLID" (in all capital letters, without the quotes). The “Field Label” can be anything you want. Set the field length to 255 characters. Make this field read-only so your users don't accidentally alter it.
    2. Enable field history tracking for the "Lead status" field.
    3. Map your new Lead.GCLID field to the new Opportunity.GCLID field.
Step 2: Edit your website to save the click ID in a cookie

If you’ve already set up AdWords Conversion Import, you’ve already done this step and can skip it now.

When a visitor clicks on your AdWords ad, AdWords will append a "gclid" URL parameter to the URL that leads to your landing page.

You'll need to store this parameter's value in a cookie to retrieve it later when a prospective customer enters data into the web-to-lead form. If you have a webmaster, he or she can help you edit your website code to allow you to store the GCLID value in a cookie.

If you embed the following JavaScript code immediately before the closing </body> tag of your landing page(s), the GCLID value will be saved in a cookie.

<script type="text/javascript">
function setCookie(name, value, days){
    var date = new Date();
    date.setTime(date.getTime() + (days*24*60*60*1000)); 
    var expires = "; expires=" + date.toGMTString();
    document.cookie = name + "=" + value + expires;
function getParam(p){
    var match = RegExp('[?&]' + p + '=([^&]*)').exec(;
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
var gclid = getParam('gclid');
    var gclsrc = getParam('gclsrc');
    if(!gclsrc || gclsrc.indexOf('aw') !== -1){
        setCookie('gclid', gclid, 90);

We strongly recommend that you insert this code on every web page on your site. This way, you won't need to add it every time you create new ads with new landing pages. You also won't have to worry about losing GCLIDs if you start driving ads traffic to different landing pages. So, consider adding this code to your web page template—or a shared page element like the footer—so that all your new pages will automatically include the code.

Step 3: Adjust your Salesforce web-to-lead form

To store the GCLID with your lead's information, you’ll need to modify your web-to-lead submission form(s) so all new leads will include the GCLID value. You may need help from a webmaster and Salesforce admin to complete this step.

The following explains how to add the GCLID field to your existing web-to-lead forms.

  1. Generate a standard web-to-lead form and include all fields you want your prospects to submit. Also include the lead field "GCLID". The HTML generated by Salesforce will include this code (where xxxx stands for the ID of the field GCLID):

    GCLID:<input id="xxxx" maxlength="255" name="xxxx" size="20" type="text" />
  2. Change this code to: <input id="xxxx" name="xxxx" type="hidden" />
    These changes mean that you're removing the attributes "maxlength" and "size," and changing the value of the type attribute to "hidden." Leave the attributes "id" and "name" as is (they'll be different for every Salesforce organization).
  3. Once you have created this new hidden input field, add it to the HTML of your existing web-to-lead forms in between the <form> tags.
  4. On the same HTML lead submissions page, add the following code between the <head> tags:
      window.onload = function getGclid() {        
                 document.getElementById("xxxx").value = (name = new     RegExp('(?:^|;\\s*)gclid=([^;]*)').exec(document.cookie)) ? 
    name.split(",")[1] : ""; }
     // window.onload() may not be supported by all browsers.  
     // If you experience problems submitting the GCLID as a
     // hidden field, consider using an alternate method to
     // call this function on page load.
    In this code replace "xxxx" with the ID from step 1 above.

Salesforce and your web pages are now ready to gather all the data. This script will populate the hidden field with the GCLID value, and populate the custom fields when the web-to-lead form is submitted. 

Keep in mind: your web-to-lead form needs to be located in the same domain as the rest of your web pages, so the forms can read the GCLID from your cookie.

Note: Other lead submission methods

If the lead info from your web form passes through another system before reaching Salesforce, make sure that any intermediate lead processing systems pass the GCLID through so that the GCLID value ultimately reaches your Salesforce account. The system you use should have a way to do this: if you’re not sure how, contact support for the 3rd-party solution you use.

Step 4: Test that your system is working
  1. Visit your website, adding the parameter ?gclid="test" to your URL."test"
  2. Navigate to your lead form and submit a test lead.
  3. Sign in to Salesforce, find this new test lead, and see if your custom GCLID field shows the value "test."
  4. Convert the test lead to an opportunity. The new opportunity's custom GCLID field should also show "test."
  5. Repeat steps 2 through 4 for all your lead forms to make sure that each is configured properly. If test appears in the GCLID field for leads and opportunities that originated from all of your lead forms, then you’re ready to link your accounts.
Step 5: Link your AdWords and Salesforce accounts

In this step, you’ll need to sign in to Salesforce. See the permissions requirements here. To see the full instructions for linking your accounts, read Link AdWords and Salesforce accounts.

Tip: Cross-account conversion tracking

If you use cross-account conversion tracking on your manager account (MCC), you must link your Salesforce account with your manager account. Otherwise, feel free to link with your non-manager account.

Step 6: Set up your conversion actions

Once your AdWords and Salesforce accounts are linked, you need to choose which milestones––lead statuses and opportunity stages––to monitor for conversions. This means that every time a lead or opportunity progresses to one of these points, a conversion will be recorded in AdWords.

  1. Next to the Salesforce account you want to linked, click Set up conversions. (If you clicked “Set up conversions” from the dialogue box after linking accounts in Step 6, you can skip this step.)
    Salesforce accounts page
  2. Check the boxes under "Milestone" to select the lead statuses and opportunity stages that you want to import as AdWords conversions.
  3. In the “Conversion” column, click the dropdown menu for your first selected milestone and select Create a conversion.
  4. Click Name. Enter a conversion name that will help you recognize this action later when it shows up in conversion reports. An example might be "lead sales qualified" or "new opportunity." Click Done.
    Salesforce conversion action
  5. Click Value. Select whether each conversion has the same value, you want to use the value from the opportunity's Expected Revenue field in your Salesforce account (only for opportunity stage conversions), or you don’t want to count a value. Click Done.
  6. Click Count. Select whether to count every or one conversion per ad click. Generally, "Every" is best for sales, and "One" is best for leads. Click Done.
  7. Click Conversion windows. Select a conversion window (how long after an ad click you want to track conversions) for this conversion action. To capture as many conversions as possible, select the maximum of 90 days. Click Done.
  8. Click Create
  9. Repeat steps 3 to 8 for each of the rows you selected in step 2.
  10. Under “Import schedule,” select from the drop-down menu how frequently you want AdWords to import your conversions. Then select a time for your imports.

    Note: If you use an AdWords automatic bidding strategy to bid for conversions, your bidding strategy will work best if you upload conversions frequently, ideally once a day.
    Salesforce import schedule
  11. Click Save.

How conversion value is imported

If you've asked us to import conversion value from your Sales Cloud account, AdWords calculates the value by multiplying the opportunity stage's "Probability" value (as configured in your Sales Cloud account) by the most recent value in the opportunity's "Amount" field.  


Imagine you told AdWords to import your conversions weekly, and the last import was 7 days ago. Two days ago, you mark an opportunity's stage as "Negotiating". The opportunity's "Amount" value is $1,000 and the probability for the negotiating stage is 75%. Yesterday you change the opportunity's "Amount" value to $1,600. AdWords then imports your conversion today and calculates the conversion value as $1,200 (75% x $1,600).

If you feel strongly that the conversion value should be calculated based on the amount value that was set at the time to opportunity stage changed, then we recommend that you set your imports to happen daily.

Tip: Edit your Salesforce conversion actions

To change which Salesforce milestones you want to track as conversions, follow the instructions below:

  1. In your Adwords account, click the Tools menu.
  2. Select Conversions.
  3. In the menu on the left, click
  4. You’ll see the Salesforce accounts you’ve linked. Click Edit next to the account you want to edit conversion actions for.
  5. You can now create new conversion actions by following the instructions above. To remove a conversion action, uncheck the milestone.
  6. Click Save.
Step 7: Import your conversions

Your account will now automatically import conversions from Salesforce on the schedule you’ve set up.

To make sure everything is working correctly, click Import now to manually import conversions. Stay on this page until the import is complete, and you’ll see a message letting you know if the import was successful or not.

The first time you request an import, AdWords will retrieve all conversions that occurred within the last 14 days. For every subsequent import, we’ll include all conversions since the last import (up to 14 days previous), so it's important to import your conversions at least once a week. 

The import can take a few minutes depending on how many conversions will be uploaded. The “Import now” button will be disabled when an import is taking place, when you haven’t mapped any Salesforce leads and opportunities to AdWords conversion actions, or when there are unsaved changes to your conversion actions.

If there's a problem with one of your scheduled imports, you'll receive a notification in your AdWords account.

How to review your import history

  1. Sign in to your AdWords account.
  2. Click the Tools menu, and select Conversions.
  3. In the menu on the left, click
  4. Choose the Salesforce account you want to view, and click Edit.
    Edit Salesforce conversion
  5. Click View import history.
    View import history button
  6. You'll now see your import history in a pop-up window.
    Import history

How to fix errors

If you encounter an error while uploading Salesforce conversions, please see this article.

Was this helpful?
How can we improve it?
Previous New