How to set up a Salesforce integration

The "Linked Accounts" page under Admin Admin Icon has been moved to "Data manager" under Tools Tools Icon. Google Ads Data Manager is a data import and management tool with a point-and-click experience that lets you bring your customer data from outside of Google and activate it in Google Ads. Learn more About Data manager.

Setting up a Salesforce integration allows you to measure your offline conversion events (that are post-lead) to import them directly into Google Ads. This will enable you to measure, report and optimize offline events, and schedule automated imports. It supports either user-provided data (such as email) or GCLID join keys, to enable enhanced conversions for leads and offline conversions import conversion solutions.

Note: This information applies to the standard integration with Salesforce. If you notice “Salesforce” on the list of import sources while creating a new conversion action from import, you’re using the legacy integration with Salesforce. You’ll have an option to upgrade your Salesforce integration in the future.

On this page

How to set up for enhanced conversions for leads

Before you begin

  • Have a Salesforce credential that meets the minimum permissions requirements in your Salesforce account.
  • Be able to make changes in your Salesforce account, including enabling API and enabling field history tracking.
  • Configure Google tag and use Google Tag Manager to appropriately capture website conversions and leads.
  • Make sure that there is first-party customer data available (email and/or phone number) on your website lead form.
  • Ensure that you’ve reviewed and confirmed that you can comply with the customer data policies in Google Ads.
  • Before setting up enhanced conversions for leads, you’ll need to identify your website lead forms and pick a field from the form that uniquely identifies your leads. At least one of the following variables must be provided when you configure enhanced conversions for leads on your website and when you later import the conversions:
  • Email (preferred)
    • Remove leading or trailing whitespaces.
    • Convert the text to lowercase.
    • Remove all periods (.) that precede the domain name in.
  • A phone number
  • We recommend using the lead's email address because it’s a highly unique identifier and isn’t prone to being reformatted in your CRM. If you're using a phone number, the tag will remove symbols and dashes, but the number must contain a country code.

How to set up for offline conversions import

Before you begin

  • 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 won’t 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

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. The following are basic instructions, 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.

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, they 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 or fields should contain the GCLID value. When this modification is complete, 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>

It is strongly recommended 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 check 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 a 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: Set up Conversions actions

You can edit your conversion actions based on changes to values in your data source, such as when a lead becomes verified or qualified. To get started, set up a suggestion or add a custom event.

Open Tools > Data manager. Select the connection you just made from Connected products and under Usage, click + Add conversion action.

  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. Click New Conversion Action.
  5. Select Import in the new “Conversion action” page.
  6. Select CRMs, files, or other data sources and then Track conversions from clicks.
  7. In the “Data Source” section, choose to either “Connect a new data source”. Click Continue.
  8. Select Salesforce from the dropdown.
  9. If you have an existing Salesforce link already, choose Direct connection. To connect to your data source, you'll need to log in to authorize the account to share data with Google. You can manage the connection at any time in Connected products tab of Data manager. If not, choose Third-party integration by Zapier. To connect using a third-party integration provided by Zapier, additional steps are required, and Zapier may charge a fee.
  10. Click Authorize to set up a link between Salesforce and Google Ads.
  11. Salesforce authorization flow opens up. Provide your Salesforce credentials in your Salesforce account. If you’re unable to view the login window, make sure pop-ups are allowed for ads.google.com. Click Log in.
  12. Click Done, then click Continue.
  13. You’ll notice a table with a list of suggested events and an option to add custom event.
  14. If you want to choose any of the suggested conversion events, you may click Set up option corresponding to that event. However, if you want to set up a custom event, define the event condition below and click Set up. To define a new custom event, follow the below mentioned steps:
    1. Select a conversion goal, then click Set up.
    2. Select the Salesforce object your event will use.
    3. In the filter tab, define the conditions for when an event has occurred.
    4. Click Continue.
  15. To map Salesforce fields, select the fields that you use in your data source and add any additional fields that you want to import. Some fields would be automatically mapped based on your data source.
    • Note: In the mapping screen you can see “GCLID” mentioned in the Google Ads fields. Also note that the "conversion time" field doesn’t need to be manually mapped. The value is automatically determined by the timestamp of the corresponding Lead or Opportunity field change that met the event condition for the import, pulled from the history.
  16. Click Continue.
  17. You can revise the default data integration name and the data integration setup one last time and click Done. You’ll now be able to view the newly defined event. For the Salesforce integration for offline conversions import, the conversion source column would read “Website (Import from clicks)”. The conversion action name will reflect the event condition specified (for example “When the Opportunity field "Stage" becomes "Closed Won" “).
  18. Optional: Add a conversion action to your connection.
    Open Tools > Data manager. Select the connection you just made from Connected products and under Usage, click + Add conversion action.

Learn more about how to Create a conversion.

Note: You can either ingest conversions for enhanced conversions for leads or regular gclid-based offline conversion import. If you previously made the decision to not use enhanced conversions for leads, you won't be prompted with that option the next time you create a conversion action. You can change the option to turn on enhanced conversions for leads at any time in the Settings view.

How conversion value is imported

In the new Salesforce integration, the conversion value is determined by mapping any value field in Salesforce(Source field) to the value in the destination field in Google Ads account. If you don’t map any field to your value field, the default conversion action behavior is to use one. But if you did map a value, you would use that value instead.

How to edit your Salesforce conversion actions

  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. Click on the conversion action you want to edit.
  5. Under Data integration, click Manage towards the right.
  6. To update the link, click Update link. You'll notice the Salesforce login page. Provide your login credentials and update the link.
  7. To provide a different Data Integration Name, click Edit Name, add the name, then click Save.
  8. To change frequency, days, start time, time zone, click Edit schedule and click Save.
  9. To change any field mapping, click Edit mapping and then click Save.
  10. To update what counts as a conversion, click Edit for the event condition. You can update the Event conditions and then click Continue.
  11. You can also add new event conditions to the existing data integration by clicking on Add Event.
  12. [Optional] Click Run Now on the top right corner of the “Runs” section to run the import job without waiting for the next scheduled time. Note: after creating a new conversion action, you’ll need to wait for 4-6 hours before uploading conversions for that conversion action.

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 Settings.
  4. Click View data integration to review import history.
  5. Check columns “Rows imported” and “Rows with errors”.
  6. Successful import is when the number under column “Rows imported” is one or more than one. It means that the event was successfully imported from Salesforce (well-formed and valid data). It may not show up as a conversion if the lead came from a non-Google campaign.
  7. “Error” is when the number under the column “Rows with errors” is one or more than one. It means that the conversion wasn’t successfully imported from the CRM because it wasn’t well-formed nor valid (for example missing field).

How to fix errors

If you encounter an error while uploading Salesforce conversions, review how to Fix issues with importing Salesforce conversions using Salesforce integration.

Tip

  • After creating a new conversion action, you’ll need to wait for 4-6 hours before uploading conversions for that conversion action. If an integration is run too soon after the new conversion action is first created, you may receive an error. The conversions that failed to import due to this error will be retried when the integration is run the next time.
  • Configure integrations to run on a daily schedule.
  • After import, even if successful, it may take up to 24 hours before reporting as a conversion.
  • The first-ever import will look at only import events going back to 14d.
  • If a Salesforce event fails in import, it won’t retry and import the event again automatically.

Related link

Was this helpful?

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