How to set up a legacy integration with Salesforce

This article reviews the steps to follow to set up a legacy integration with 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. Note that you should be able to edit your website code. You or your web developer will have to edit your code to capture the Google click ID (GCLID).

Note: Legacy integrations with Salesforce are being updated to a new experience. To learn about the migration to the new experience, see Salesforce integration upgrade FAQ. To check which Salesforce integration is currently active in your account, for the legacy integration with Salesforce, you’ll notice “Salesforce” on the list of sources to import while creating a new conversion action from import. Otherwise, you have the standard integration with Salesforce.

Before you begin

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

  • Have a Salesforce credential that meets the minimum permissions requirements in your Salesforce account.
  • 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.
  • Have auto-tagging enabled in your Google Ads account.
  • Be able to edit your website code. You or your web developer 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.
  • 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.

Instructions

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:
    • 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.
    • Enable field history tracking for the "Stage" field.
  2. Update your Lead object with the following changes:

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 all new leads will include the GCLID value. You may need help from a web developer 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" as a 'hidden' field. Your Salesforce admin or web developer will know how to make this change.
  2. Your web developer 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 web developer 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.
Note: You should make sure that you are observing local regulations regarding cookie consent.

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

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 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 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 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 it can retrieve it later when a prospective customer enters data into the lead form. If you have a web developer, he or she can help you edit your website code to do this.

We recommend you accomplish this by modifying and embedding the following JavaScript code. Before you embed the code, be sure to update the 'var gclidFormFields' line to include the field IDs of the new fields 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. 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 4: Test that your system is working

  1. Visit your website, adding the parameter ?gclid="test" to your URL.
    • Example: http://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 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 Google Ads and Salesforce accounts

In this step, you’ll need to sign in to Salesforce. You should use a dedicated Salesforce login, instead of your own personal login. 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 events (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 Google Ads. Keep 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 events matches your sales funnel.

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Salesforce. You’ll notice 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 events 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. Keep in mind that:
      • The conversion name you enter will help you recognize 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. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Summary.
  4. This takes you to a page that lists your conversion actions.
  5. Click the plus button , then click Import.
  6. Select Salesforce, then click Continue.
  7. 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 events, you can select more than one milestone.
  8. Complete the conversion action settings.
  9. Click Create and continue.
  10. 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 events are imported as conversions, click Salesforce in the menu on the left and refer to the previous set of steps for scheduling imports. For the legacy integration with Salesforce, the conversion source column would read “Website (Salesforce.com)”.

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 7 days ago. Two days ago, you mark an opportunity's stage as "Negotiating". The opportunity's "Amount" value is $1,000 USD and the probability for the negotiating stage is 75%. Yesterday, you change the opportunity's "Amount" value to $1,600 USD. Google Ads then imports your conversion today and calculates the conversion value as $1,200 USD (75% x $1,600 USD).

If you feel strongly that the conversion value should be calculated based on the amount value that was set when 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 events you want to track as conversions, follow the instructions below:

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Salesforce.
  4. Click the Salesforce account with events 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 you’ve set up.

To make sure everything is working correctly, manually import conversions. In your Google Ads account, go to the page that lists your Salesforce events, and click Import now. 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, 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. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Salesforce.
  4. 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 review 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 3 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, review how to Fix issues with importing Salesforce conversions using the legacy integration with Salesforce.

Related link

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
18102580598548226248
true
Search Help Center
true
true
true
true
true
73067
false
false
false