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's less than 90 days. Any conversion uploaded more than 90 days after the last click associated with it occurred 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, organised by object.  A user account with System Administrator access may already have access to these fields.

  • Organisation: ID, Name, OrganisationType
  • LeadStatus: ID, MasterLabel, SortOrder
  • OpportunityStage: ID, MasterLabel, SortOrder, IsActive
  • LeadHistory: CreatedDate, OldValue, NewValue, Field
  • Lead: Status, GCLID (a custom field that you’ll create in the steps below)
  • OpportunityFieldHistory: CreatedDate, OldValue, NewValue, Field
  • Opportunity: Amount, Probability, StageName, GCLID (a custom field that 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 Customise, 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 customise 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.

Step 1: Configure your Salesforce account

Before getting started, you’ll want to make sure that 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 that you want. Set the field length to 255 characters. Make this field read-only so that 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 that you want. Set the field length to 255 characters. Make this field read-only so that 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: 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 that 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 the fields that you want your prospects to submit. Also include the lead field 'GCLID' as a 'hidden' field. Your Salesforce admin or webmaster will know how to make this change.
  2. Your webmaster will need to note the new GCLID input field's ID, as this is needed for the next step where they implement the JavaScript on your site.
  3. Your webmaster will then take this new form HTML code and update your existing forms. This means that your forms will now pass the GCLID value along with the lead's information into Sales Cloud.

Salesforce and your web pages are now ready to gather all the data. In the next step, your webmaster will update your site so the GCLID value is automatically passed to the new GCLID form field

Bear in mind: your web-to-lead form needs to be located in the same domain as the rest of your web pages, so the JavaScript can properly transfer the GCLID value to the form.

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 that you use should have a way to do this: if you’re not sure how, contact support for the third-party solution that you use.

Step 3: Edit your website to collect and save the click ID

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

Your site will need to capture and store this parameter's value so that it can retrieve it later when a prospective customer enters data into the lead form. If you have a webmaster, he or she can help you edit your website code to do this.

We recommend that you accomplish this by modifying and embedding the following JavaScript code. Before you embed the code, make sure that you update the 'var gclidFormFields' line to include the field IDs of the new fields that you added in the previous step. This is how the JavaScript knows which field(s) should contain the GCLID value. Once this modification is done, you should embed this code immediately before the closing </body> tag of all your pages.

<script>

function getParam(p) {
  var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
  return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}

function getExpiryRecord(value) {
  var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90-day expiry in milliseconds

  var expiryDate = new Date().getTime() + expiryPeriod;
  return {
    value: value,
    expiryDate: expiryDate
  };
}

function addGclid() {
  var gclidParam = getParam('gclid');
  var gclidFormFields = ['gclid_field', 'foobar']; // all possible gclid form field ids here
  var gclidRecord = null;
  var currGclidFormField;

  var gclsrcParam = getParam('gclsrc');
  var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1;

  gclidFormFields.forEach(function (field) {
    if (document.getElementById(field)) {
      currGclidFormField = document.getElementById(field);
    }
  });

  if (gclidParam && isGclsrcValid) {
    gclidRecord = getExpiryRecord(gclidParam);
    localStorage.setItem('gclid', JSON.stringify(gclidRecord));
  }

  var gclid = gclidRecord || JSON.parse(localStorage.getItem('gclid'));
  var isGclidValid = gclid && new Date().getTime() < gclid.expiryDate;

  if (currGclidFormField && isGclidValid) {
    currGclidFormField.value = gclid.value;
  }
}

window.addEventListener('load', addGclid);

 </script>

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. Consider adding this code to your web page template (or a shared page element, such as the footer), so that all of your new pages will automatically include the code.

Step 4: Test that your system is working
  1. Visit your website, adding the parameter ?gclid="test" to your URL.

    http://www.example.com?gclid="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 two to four 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 Google Ads 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 Salesforce and Google Ads 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 Google Ads and Salesforce accounts are linked, you need to choose which Salesforce milestones – lead statuses and opportunity stages – to monitor for conversions. This means that every time that a lead or opportunity progresses to one of these points, a conversion will be recorded in Google Ads. Bear in mind that if a lead or opportunity moves back to a prior stage or status, Google Ads won’t record it as a conversion. In Salesforce, make sure that the order of your milestones matches your sales funnel.

  1. Click the tools icon in the top right-hand corner of your Google Ads account.
  2. Under "Measurement", click Conversions.
  3. Click Salesforce in the left menu. You’ll see a list of all Salesforce accounts that are linked to your Google Ads account.
  4. Click the Salesforce account that you just linked. This takes you to a page that has a list of Salesforce milestones for that account.
  5. For each milestone you’d like to associate with a conversion action, follow these steps:
    1. Click the Conversion action drop-down.
    2. Click Create a new conversion action, then complete the conversion action settings. Bear in mind that:
      • The conversion name you enter will help you recognise the conversion action later when it shows up in conversion reports. An example might be "Lead sales qualified" or "New opportunity".
      • To capture as many conversions as possible, select the maximum conversion window of 90 days.
    3. Click Create and continue.
    4. When you see the confirmation page that your milestone has been mapped to your conversion action, click Done.
  6. Schedule your conversion imports:
    1. Click the Import schedule section.
    2. Use the drop-down menus to select how frequently you want Google Ads to import your conversions and at what time. If you use a Google Ads automatic bidding strategy to bid for conversions, your bidding strategy will work best if you upload conversions frequently, ideally once a day.
    3. Click Save.
  7. Click Back to return to your “Salesforce accounts” page.

You also have the option of setting up your Salesforce conversion actions from the “Conversion actions” page.

  1. Click the tools icon in the top right-hand corner of your Google Ads account.
  2. Under "Measurement", click Conversions. This takes you to a page that lists your conversion actions.
  3. Click the plus button , then click Import.
  4. Select Salesforce, then click Continue.
  5. In the “Accounts & Milestones” section, click on the Salesforce account that you’d like to track for conversions, then select a milestone that Google Ads should report as a conversion. If you want to use the same conversion action settings for your milestones, you can select more than one milestone.
  6. Complete the conversion action settings.
  7. Click Create and continue.
  8. When you see the confirmation page that your milestone has been mapped to your conversion action, click Done. To map another milestone to a conversion action, click Set up another Salesforce conversion action.

    Note that this only creates a conversion action to map to your Salesforce milestone. To schedule how often your Salesforce milestones are imported as conversions, click Salesforce in the menu on the left and refer to the previous set of steps for scheduling imports.

How conversion value is imported

If you've asked us to import conversion value from your Sales Cloud account, Google Ads 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.  

Example

Imagine you told Google Ads to import your conversions weekly, and the last import was seven 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. Google Ads 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 that the opportunity stage changed, then we recommend that you set your imports to happen daily.

How to edit your Salesforce conversion actions

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

  1. Click the tools icon in the top right-hand corner of your Google Ads account.
  2. Under "Measurement", click Conversions.
  3. Click Salesforce in the left menu. 
  4. Click the Salesforce account with milestones mapped to conversion actions that you’d like to edit.
  5. Choose from the following options:
    • To change the conversion action mapped to a Salesforce milestone, click the drop-down and select a different conversion action or create a new conversion action.
    • If a conversion action should no longer be mapped to a Salesforce milestone, click Unselect conversion action.
  6. Click Back.
Step 7: Import your conversions

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

To make sure that everything is working correctly, manually import conversions. In your Google Ads account, go to the page that lists your Salesforce milestones, and click Import now. Stay on this page until the import is complete, and you’ll see a message letting you know whether or not the import was successful.

The first time you request an import, Google Ads 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" link will be disabled when an import is taking place, when you haven’t mapped any Salesforce leads and opportunities to Google Ads 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 Google Ads account.

How to review your import history

  1. Sign in to your Google Ads account.
  2. Click the tools icon in the top right-hand corner of your Google Ads account.
  3. Under "Measurement", click Conversions.
  4. Click Salesforce in the left menu. 
  5. Click Import history along the top of the page. Browse the columns on the “Import history” page to learn more about the status of your upload:
    • The “Status” column lets you quickly see whether your Salesforce conversions were imported successfully.
    • The “Results” column provides links to view the conversions that were imported and which ones weren’t due to file errors.
    • The “Actions” column provides the following links:
      • Download results: Download a copy of your uploaded file. This link appears when all the conversions in your file were imported successfully.
      • Download all: Download a copy of your uploaded file, including conversions that failed to import.
      • Download errors: Download a spreadsheet that lists the conversions from your file that failed to import, along with error messages.

      When you select any of the three links above, the downloaded file includes a “Results” column that confirms that a conversion was imported successfully or explains why it failed to import. These links are removed 30-60 days after your initial upload.

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?

Need more help?

Sign in for additional support options to quickly solve your issue