# How to track lead source in Salesforce

Push UTMs, lead source, and the full visitor journey into Salesforce Lead, Contact, Account, and Opportunity records. OAuth integration with sandbox and production support.

Source: https://sourceloop.ai/help/connect-salesforce-to-sourceloop/
Updated: 2026-05-28

---

Salesforce is the system of record for most B2B sales teams, but Salesforce's native attribution stops at a single `LeadSource` field with no multi-touch model and no historical journey. SourceLoop adds: first-touch and last-touch source on every Lead and Contact, the full UTM trail, the visitor's pre-conversion journey, and multi-touch attribution models that respect Salesforce's Lead → Contact → Opportunity flow.

This article covers the OAuth connect flow only. After connecting, see:
- [Push UTMs and lead source to Salesforce fields](/help/push-utms-to-salesforce/)
- [Map SourceLoop stages to Salesforce Lead Status](/help/map-salesforce-lead-status/)

## Why connect Salesforce to SourceLoop?

Salesforce ships with one `LeadSource` field per Lead. SourceLoop adds:

- **First-touch source / medium / campaign** as separate fields, so you know the original channel even after multiple touchpoints
- **Last-touch (converting session) source / medium / campaign** as separate fields
- **Full UTM trail** with content and term, not just source and medium
- **Visitor journey** (every page browsed pre-conversion) viewable on the Lead / Contact record
- **Multi-touch attribution models** (first, last, linear, position-based, time-decay)
- **Revenue-by-channel** when payment integrations are connected, attributed back to the original Lead

All of this sits on standard Salesforce records, so it shows up in Salesforce reports, Lightning record pages, and any workflow / process you build against it.

## Before you start

You'll need:

- A **SourceLoop workspace** with the [tracking pixel installed](/help/install-the-tracking-pixel/)
- A **Salesforce org** (Sales Cloud or Service Cloud; any edition)
- A Salesforce user with **System Administrator** profile, or Modify All Data + API Enabled permissions, to run the OAuth connect
- **Admin** or **Owner** role in SourceLoop

## Step 1: Open the CRM integrations page

1. Sign in to [SourceLoop](https://app.sourceloop.ai/).
2. Click **Setup** in the left sidebar.

![SourceLoop Home page with the Setup entry in the left sidebar highlighted](/help/screenshots/sourceloop-setup-navigation.webp)

3. Click the **CRM** tab inside Setup.

![SourceLoop Setup CRM page showing the supported CRM provider cards including HubSpot, Salesforce, and Pipedrive](/help/screenshots/sourceloop-crm-integration-page.webp)

4. Scroll to the **Salesforce** card.

![SourceLoop CRM drawer with the Salesforce Connect button and sandbox toggle highlighted](/help/screenshots/sourceloop-connect-salesforce.webp)

## Step 2: Pick sandbox or production

1. On the Salesforce card, toggle **Sandbox** ON if you want to connect to your sandbox org first (recommended for first-time setups).
2. Leave it OFF to connect to production.
3. Click **Connect**.

You'll be redirected to Salesforce's OAuth consent screen, either `login.salesforce.com` (production) or `test.salesforce.com` (sandbox).

> **Connect to sandbox first**
> Most teams connect to a Salesforce sandbox first, validate the field mappings and stage mappings against test data, and then connect production once the mapping is dialed in. Sandbox and production connections live side-by-side in SourceLoop, you can have both at once.

## Step 3: Authorise SourceLoop on Salesforce

1. Sign in to Salesforce if you aren't already.
2. Pick the org you want to connect (if you have multiple Salesforce users).
3. Review the scopes SourceLoop is requesting (API access, refresh_token, offline_access).
4. Click **Allow**.

Salesforce redirects you back to SourceLoop. The connection card flips to **Connected** and shows your Salesforce instance URL (e.g., `acme.my.salesforce.com`).

> **Salesforce tokens auto-refresh**
> Salesforce OAuth access tokens are 2-hour-lived. SourceLoop stores the refresh token and rotates the access token automatically, no manual reconnect needed unless you revoke the connection in Salesforce.

## Step 4: Enable sync direction

After connecting, the Salesforce drawer opens with sync settings:

1. **Inbound sync** (Salesforce → SourceLoop): pulls Leads, Contacts, Accounts, and Opportunities into SourceLoop so dashboards reflect your real pipeline.
2. **Outbound sync** (SourceLoop → Salesforce): pushes UTM, source, and journey data from SourceLoop into Salesforce fields on Lead and Contact records.

Most teams enable both. Click **Save** to start the first sync.

## Step 5: Wait for the initial sync

The initial sync pulls Salesforce records into SourceLoop. Duration depends on volume:

- Small org (under 10k Leads + Contacts): under 5 minutes
- Mid-size (10k-100k): 10-30 minutes
- Large org (100k+): up to a few hours

The sync runs server-side, you don't need to keep SourceLoop open. Watch the **Last sync** timestamp on the Salesforce card.

After the initial run, deltas sync every 15 minutes automatically.

## What gets written to Salesforce

Out of the box, SourceLoop creates and writes to these custom fields on the **Lead** object (and mirrored on **Contact** via Salesforce's lead-conversion mapping):

- `sourceloop_first_source__c`, `sourceloop_first_medium__c`, `sourceloop_first_campaign__c`, etc.
- `sourceloop_latest_source__c`, `sourceloop_latest_medium__c`, `sourceloop_latest_campaign__c`, etc.
- `sourceloop_first_landing_page__c`, `sourceloop_latest_landing_page__c`
- `sourceloop_id__c` — internal link (don't delete)

These fields are created automatically on first sync, you don't need to pre-create them in Salesforce.

For mapping to your own existing custom fields (or to standard fields like `LeadSource`), see [Push UTMs and lead source to Salesforce fields](/help/push-utms-to-salesforce/).

## What's next

- **Field mapping** — by default SourceLoop maps to its own `sourceloop_*` fields. To map to your existing fields or push to specific custom objects, see [Push UTMs to Salesforce](/help/push-utms-to-salesforce/).
- **Lead Status mapping** — translate SourceLoop's internal lifecycle stages to Salesforce's `Lead Status` picklist values. See [Map SourceLoop stages to Salesforce Lead Status](/help/map-salesforce-lead-status/).
- **Troubleshooting** — if a sync looks stuck or fields aren't writing, see [Troubleshoot Salesforce sync issues](/help/troubleshoot-salesforce-sync/).

## Frequently Asked Questions

### Do I need Salesforce Sales Cloud or Service Cloud?

Either works. SourceLoop reads and writes against standard Salesforce objects (Lead, Contact, Account, Opportunity) which exist in every edition. Marketing Cloud is not required.

### Does this work with a Salesforce Sandbox?

Yes. There's a sandbox toggle on the Salesforce connect screen. Flip it on, OAuth goes through test.salesforce.com instead of login.salesforce.com, and SourceLoop hits your sandbox endpoints. Sandbox and production connections are separate, you can have both at once.

### Will SourceLoop overwrite my existing Salesforce Lead Source field?

Only if you explicitly map SourceLoop's first-touch source field to Salesforce's standard `LeadSource` field. By default, SourceLoop writes to its own custom field (`sourceloop_first_source__c`) so your existing LeadSource values are preserved. You can change the mapping in the Field Mapping tab.

### How does SourceLoop handle Lead conversion to Contact / Account / Opportunity?

When a Salesforce Lead is converted, the source and UTM data on the Lead are carried onto the resulting Contact, Account, and Opportunity via Salesforce's standard conversion mapping. SourceLoop's custom fields are mapped on both Lead and Contact, so the attribution survives the conversion process.

### I use Lightning Experience. Does that matter?

No. SourceLoop uses the Salesforce REST and Bulk APIs, which are UI-agnostic. Both Lightning and Classic users see the same SourceLoop data on records once it's synced in.

### Can I sync multiple Salesforce orgs?

One Salesforce org per SourceLoop website. For multiple orgs, create a separate SourceLoop website for each and connect them independently.
