Search
Clear search
Close search
Google apps
Main menu
true

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.

Select the AdWords experience that you're using. Learn more

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

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

Was this article helpful?
How can we improve it?
Previous New
Reach more customers with an online ad

With AdWords, you can run ads on Google to stand out on local searches. Only pay when your ad is clicked on. [Learn more]

Sign Up for AdWords