Search
Clear search
Close search
Google apps
Main menu

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 AdWords. This will help you better measure how your online AdWords 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 AdWords 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 AdWords 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 AdWords, 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

AdWords 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 AdWords and Salesforce account, you can follow the instructions to manually import conversions from Salesforce.

How to set up AdWords Conversion Import for Salesforce®

Follow the steps below to prepare your Salesforce account, AdWords account and website; link your Salesforce and AdWords 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). (“GCLID” is short for “Google click ID”, the ID that indicates that a customer came from one of your AdWords ads.) The “Field Label” can be anything 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). (“GCLID” is short for “Google click ID”, the ID that indicates that a customer came from one of your AdWords ads.) The “Field Label” can be anything 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: 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(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var gclid = getParam('gclid');
if(gclid){
    var gclsrc = getParam('gclsrc');
    if(!gclsrc || gclsrc.indexOf('aw') !== -1){
        setCookie('gclid', gclid, 90);
    }
}
</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 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 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". 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 organisation).
  3. Once you've 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:
    </script> 
      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 alternative method to
     // call this function on page load.
     </script>
        
    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. 

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 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 third-party solution you use.

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 2 to 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.

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.

  1. In your AdWords account, click the gear icon , then select Linked accounts.
    Linked accounts in gear menu
  2. Under "Salesforce", click View details.
  3. Click on + Account.
  4. Click on Continue to open the Salesforce authentication page.
  5. Enter the credentials for your Salesforce account.
  6. If there were any problems linking your account, you'll see a message with any steps you need to take. If the link was successful, you'll see a confirmation message. To continue on to the next step, click on Set up conversions. To come back to this later, click on Do this later.
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 link, click on Set up conversions. (If you clicked on “Set up conversions” from the dialogue box after linking accounts in Step 6, you can skip this step.)
    Salesforce accounts page
  2. Tick 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 on the drop-down menu for your first selected milestone and select Create a conversion.
  4. Click on Name. Enter a conversion name that will help you recognise this action later when it shows up in conversion reports. An example might be "lead sales qualified" or "new opportunity". Click on Done.
    Salesforce conversion action
  5. Click on 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 on 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 on Done.
  7. Click on 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 on Done.
  8. Click on Create
  9. Repeat steps 3 to 8 for each of the rows that 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 on 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.  

Example:

Imagine you told AdWords 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. 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 on Salesforce.com.
  4. You’ll see the Salesforce accounts that you’ve linked. Click on Edit next to the account that 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, untick the milestone.
  6. Click on Save.
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, click on 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 on the Tools menu, and select Conversions.
  3. In the menu on the left, click on Salesforce.com.
  4. Choose the Salesforce account that you want to view, and click on Edit.
    Edit Salesforce conversion
  5. Click on 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

Occasionally, you may encounter an error when linking your AdWords and Salesforce accounts, setting up your conversion actions or importing conversions. View the sections below for errors that you might see and how to fix them.

If the error requires changes in your Salesforce account, it may take up to 24 hours before the change is reflected in AdWords. If you continue to see the error after fixing the problem, please wait 24 hours, or unlink and relink the accounts.

Errors when linking your accounts or setting up conversion tracking
  • We can't access your Salesforce account. Contact your Salesforce account administrator about the following error. You may see this error if, for example, your permissions have changed, you don’t have the correct permissions to the Salesforce account or if there’s a temporary error in your Salesforce account. We’ll show you the error information from Salesforce to give you more information. Sign in to your Salesforce account, or, if someone else is the administrator for your Salesforce account, contact them with the information from the error message.
  • An AdWords API error occurred. Please try linking your account again. Something went wrong in the AdWords API. Just try linking your accounts again.
  • These accounts are already linked. You’ve already linked this Salesforce account to your AdWords account. You can see your linked Salesforce accounts by clicking on the gear icon  and selecting "Linked accounts."
  • The Salesforce login you provided no longer has access to this account. The username and password you provided no longer have access. Talk to the person who manages the Salesforce account for your business about getting access.
  • You haven’t linked any Salesforce accounts. You can’t import conversions until you’ve linked your accounts.
  • Your Salesforce account has no milestones (lead statuses or opportunity stages) to import. Set up lead statuses or opportunity stages in your Salesforce account.
Account-level errors
  • This account is unlinked. View linked accounts. You’ve unlinked this Salesforce account from your AdWords account.
  • You no longer have access to this Salesforce account. Contact your Salesforce administrator. The Salesforce login you provided no longer has access to the account. Contact the person who manages your Salesforce account about getting access again.
  • This AdWords account uses conversion tracking through a manager account. Link this Salesforce account through your manager account. If your account is managed by a manager account that uses cross-account conversion tracking, you’ll have to link your Salesforce account to the manager account to track conversions.
  • Not configured. You’ve linked this account, but you haven’t set up any conversion actions yet, so no conversions are being imported.
  • You can't import conversions for leads because you don't have access to the necessary Salesforce fields. Check with your Salesforce account administrator to make sure that you have access to the required fields. Note that you may be missing access to multiple fields.
  • You can't import conversions for opportunities because you don't have access to the necessary Salesforce fields. Check with your Salesforce account administrator to make sure that you have access to the required fields. Note that you may be missing access to multiple fields.
  • You can't import conversions for leads because your Salesforce leads are missing the GCLID column. See Step 1 above to add the GCLID field to your Salesforce leads.
  • You can't import conversions for opportunities because your Salesforce opportunities are missing the GCLID column. See Step 1 above to add the GCLID field to your Salesforce opportunities.
  • You can't import conversions because you don't have access to the necessary Salesforce fields. Check with your Salesforce account administrator to make sure that you have access to the required fields. Note that you may be missing access to multiple fields. 
  • The import failed. Fix the following error from Salesforce and try again. You’ll see error information from Salesforce. Sign in to your Salesforce account, or, if someone else is the administrator for your Salesforce account, contact them with the information from the error message.
Errors for individual milestones
  • The milestone is not being imported because the AdWords conversion action has been removed. You’ll need to change the status of your conversion action back to “Enabled” or create a new conversion action for this milestone.
  • The milestone is not being imported because it no longer exists in Salesforce. The milestone has been removed in the Salesforce account. Talk to the person who manages the Salesforce account for your business. Note that you won’t receive this error if the milestone was removed from your sales process, but only if it was deleted from Salesforce.
Was this article helpful?
How can we improve it?
Sign in to AdWords

Get account-specific help and tips by signing in with your AdWords account email address, or learn how to get started with AdWords.