Gifts

Culture

Reviews

Local Spots

How to Setup Salesforce with Google Analytics (2026 Guide)

Salesforce

★★★★ 4.5
Crm Enterprise Crm

The world's leading cloud-based CRM platform powering sales, service, and marketing for businesses of all sizes.

Full Review

Google Analytics

Web analytics service for tracking website traffic and user behavior.

All Google Analytics Tools

How to Connect Google Analytics to Salesforce

Connecting Google Analytics to Salesforce bridges website behavior data with CRM and sales pipeline data, allowing you to understand which marketing channels and website interactions lead to actual revenue. This integration is critical for B2B organizations where website visits are the starting point of long sales cycles. By linking GA4 session data to Salesforce leads, opportunities, and closed deals, you can measure the true business impact of your digital marketing efforts and optimize your strategy based on revenue outcomes rather than vanity metrics like page views.

Prerequisites

Before connecting Google Analytics to Salesforce, ensure you have the following:

  • Google Analytics 4 (GA4) property: You need an active GA4 property tracking your website. Universal Analytics has been discontinued. Set up GA4 at analytics.google.com if you have not already.
  • GA4 Editor or Admin access: You need Editor or Admin-level access to the GA4 property to configure integrations, create audiences, and set up data imports.
  • Salesforce Enterprise edition or higher: The Salesforce integration requires API access, which is available on Enterprise, Unlimited, and Performance editions. Professional edition requires an API access add-on.
  • Salesforce System Administrator access: You need admin-level access in Salesforce to configure connected apps, create custom fields, and set up data export rules.
  • Middleware tool (recommended): A direct native integration between GA4 and Salesforce is limited. Most implementations use a middleware platform like Salesforce Data Cloud, a Salesforce-certified connector, or a tool like Zapier, Supermetrics, or a custom API integration to bridge the two systems effectively.
  • UTM tracking implemented: Your marketing campaigns should use UTM parameters (utm_source, utm_medium, utm_campaign) on all URLs so that traffic source data flows into both GA4 and your web forms for Salesforce capture.

Step-by-Step Connection Guide

Because GA4 and Salesforce do not have a single-click native integration, the connection typically involves multiple steps. Here is the most common approach using Salesforce Data Import in GA4 combined with UTM-based lead source tracking:

Part 1: Capturing Website Source Data in Salesforce

  1. Create custom fields on the Salesforce Lead and Contact objects to store marketing attribution data. Create fields for: UTM Source, UTM Medium, UTM Campaign, UTM Content, UTM Term, and Landing Page URL.
  2. Add hidden fields to your website forms that capture UTM parameters and the landing page URL. Use JavaScript to read these values from the URL or cookies and populate the hidden form fields.
  3. Configure your form handler or marketing automation tool to pass these hidden field values into the corresponding Salesforce Lead fields when a form is submitted.
  4. Test by clicking a UTM-tagged URL, filling out a form, and verifying the UTM values appear on the new Salesforce Lead record.

Part 2: Importing Salesforce Data into GA4

  1. In GA4, go to Admin, then Data Import.
  2. Click Create Data Source.
  3. Select Cost Data or Offline Event Data depending on what you want to import. For revenue attribution, choose Offline Event Data.
  4. Prepare a CSV file with Salesforce conversion data formatted to GA4's requirements. Include client ID or user ID (if captured), event name (for example, "salesforce_closed_won"), event timestamp, and revenue value.
  5. Upload the CSV file to GA4. For ongoing imports, set up an automated pipeline using a tool like Supermetrics, Fivetran, or a custom script that exports Salesforce data and imports it to GA4 on a regular schedule.

Part 3: Using Salesforce Data Cloud (Alternative)

  1. If your organization uses Salesforce Data Cloud (formerly CDP), navigate to Setup in Salesforce and configure a Google Analytics connector.
  2. Authenticate with your Google account that has GA4 access.
  3. Select the GA4 property and configure which data streams to ingest.
  4. Map GA4 user and event data to Salesforce data model objects.
  5. Activate the data stream and verify data is flowing into Salesforce Data Cloud.

Configuration and Settings

Client ID Tracking

For the most accurate connection between GA4 sessions and Salesforce leads, capture the GA4 Client ID (stored in the _ga cookie) on your website forms. Create a custom field in Salesforce to store the GA4 Client ID, and add a hidden form field that captures it using JavaScript. This allows you to match Salesforce leads to their GA4 browsing sessions for complete journey analysis.

Salesforce Reports for GA4 Data

Create Salesforce reports and dashboards that use the UTM fields you created. Build reports that show lead volume, conversion rate, and revenue grouped by UTM Source, UTM Medium, and UTM Campaign. This gives your sales and marketing teams CRM-native visibility into which channels drive the best results without needing to access GA4.

GA4 Audience Definitions

In GA4, create audiences based on Salesforce-derived data. If you import offline events from Salesforce (like Closed Won), you can build GA4 audiences of users who completed those events. These audiences can be shared with Google Ads for remarketing or lookalike targeting.

Attribution Window Alignment

Align the attribution windows in GA4 and Salesforce reports. GA4's default attribution window is 30 days for acquisition events and 90 days for other events. If your sales cycle is longer, adjust GA4's attribution settings under Admin, then Attribution Settings to match your Salesforce pipeline's typical duration.

What You Can Do After Setup

  • Attribute Salesforce revenue to marketing channels: See which traffic sources (organic search, paid ads, social media, email) drive the most Salesforce pipeline and revenue by analyzing UTM data stored on lead and opportunity records.
  • Import offline conversions into GA4: Send Salesforce conversion events (MQL, SQL, Closed Won) back to GA4 for advanced analysis and Google Ads optimization. This closes the measurement loop between online behavior and offline sales outcomes.
  • Build revenue-weighted GA4 audiences: Create GA4 audiences based on users who became high-value Salesforce customers. Share these audiences with Google Ads to find similar users and optimize campaigns for revenue rather than clicks.
  • Report on full-funnel metrics: Build reports that span from GA4 website sessions through Salesforce pipeline stages to closed revenue. Understand the conversion rate at each stage and identify bottlenecks in your marketing-to-sales funnel.
  • Optimize content and pages for lead quality: Cross-reference GA4 page performance data with Salesforce lead quality data to identify which blog posts, landing pages, and content pieces generate leads that actually close as customers.

Best Practices

  • Standardize UTM naming conventions: Use a documented UTM naming convention across your entire organization. Lowercase values, consistent source names, and standardized medium names are essential. Inconsistent UTM usage creates fragmented data in both GA4 and Salesforce. Create a shared UTM builder spreadsheet or tool for your team.
  • Capture the GA4 Client ID on every form: Adding the GA4 Client ID to your Salesforce leads enables the most granular connection between website behavior and CRM data. Implement this on all lead capture forms, not just your main contact form.
  • Automate Salesforce-to-GA4 data imports: Do not rely on manual CSV uploads for ongoing data import. Set up an automated pipeline using a connector tool or custom API integration that runs daily or weekly. This ensures your GA4 data stays current with Salesforce outcomes.
  • Build a unified dashboard: Use a tool like Tableau, Looker Studio, or Salesforce CRM Analytics to build a dashboard that combines GA4 and Salesforce data. This provides stakeholders with a single source of truth for marketing-to-revenue reporting.
  • Allow for adequate data lag: B2B sales cycles often span weeks or months. Do not evaluate campaign performance based solely on short-term GA4 data. Wait until leads from a campaign have had sufficient time to progress through the Salesforce pipeline before judging its effectiveness.

Troubleshooting Common Issues

  • UTM data not appearing on Salesforce leads: Check that your website forms include hidden fields for UTM parameters and that JavaScript is correctly reading UTM values from the URL. Test by navigating to a page with UTM parameters in the URL and inspecting the hidden form fields before submitting. Also verify that form field-to-Salesforce field mapping is correct.
  • GA4 data import failing: Verify the CSV format matches GA4's import requirements exactly. Common issues include incorrect date formats, missing required columns, and using wrong identifiers. Check GA4's data import documentation for the current format specifications and re-export your Salesforce data accordingly.
  • Client IDs not matching between GA4 and Salesforce: The GA4 Client ID changes if a user clears cookies, switches browsers, or uses a different device. This means some Salesforce leads will have Client IDs that no longer map to active GA4 users. Accept a match rate of 50 to 70 percent as normal for this tracking method.
  • Salesforce API limits preventing data sync: If your automated import consumes too many Salesforce API calls, you may hit daily limits. Check API usage under Salesforce Setup, then System Overview. Optimize your queries to pull only changed records and schedule imports during low-usage periods.
  • Attribution data conflicts between platforms: GA4 and Salesforce may attribute the same conversion to different channels due to different attribution models. This is expected. Document which platform serves as the source of truth for each type of reporting and communicate this to stakeholders.

Limitations and Workarounds

  • No native one-click integration: Unlike some CRM-analytics pairs, GA4 and Salesforce do not have a simple plug-and-play connection. The integration requires custom setup involving form modifications, data pipelines, and potentially middleware tools. Workaround: Use a certified connector like Supermetrics, Salesforce Data Cloud, or a marketing attribution platform that bridges both systems.
  • Anonymous vs. identified user mismatch: GA4 tracks anonymous users by Client ID, while Salesforce requires identified contacts with names and emails. Matching the two datasets requires capturing the GA4 Client ID at the point of form submission. Users who never submit a form cannot be matched. Workaround: Focus on matching converted users and use GA4's aggregate data for pre-conversion analysis.
  • Cookie consent and data privacy: Privacy regulations and browser cookie restrictions reduce the percentage of users tracked in GA4. Salesforce leads who declined cookies on your website will not have GA4 data associated with them. Workaround: Implement GA4's consent mode to model conversions from users who did not consent to cookies, and accept that some attribution gaps are unavoidable.
  • No real-time Salesforce data in GA4: Salesforce data imports to GA4 are batch processes with inherent delays. You cannot see real-time Salesforce conversions in GA4 reports. Workaround: Use GA4 for real-time website behavior monitoring and Salesforce for real-time CRM and pipeline data. Combine them in scheduled reports for retroactive analysis.
  • Complex multi-touch attribution: Both GA4 and Salesforce handle multi-touch attribution differently and neither provides a complete picture alone. Workaround: Consider a dedicated marketing attribution tool like Bizible (now Marketo Measure), HockeyStack, or Dreamdata that is designed to bridge web analytics and CRM data for multi-touch attribution.

Salesforce Full Review » | All Google Analytics Tools »