{"id":1046,"date":"2022-05-25T18:00:24","date_gmt":"2022-05-25T18:00:24","guid":{"rendered":"https:\/\/gaconnector.com\/blog\/?p=1046"},"modified":"2026-06-30T13:13:26","modified_gmt":"2026-06-30T13:13:26","slug":"salesforce-and-ga4-integration","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/","title":{"rendered":"Salesforce Google Analytics Integration: The Complete Technical Guide (2026)"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Your GA4 dashboard shows 800 conversions last month. Your Salesforce Opportunities report shows 64 closed-won deals worth $720k. Nowhere in either tool can you see which of those 800 became which of those 64 \u2013 or which campaign earned the $180k deal that closed last Tuesday.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">That\u2019s the Salesforce Google Analytics integration problem. The Salesforce GA4 integration doesn\u2019t exist natively \u2013 there\u2019s no official connector in GA4 Admin or on the AppExchange you can click \u201cInstall\u201d on and have it work. What is there instead: six integration methods that together form a complete connect Salesforce-to-Google Analytics stack. Knowing how to integrate Salesforce with Google Analytics 4 \u2013 and which of the six methods apply to your team \u2013 is what this guide is for.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This guide focuses specifically on GA4. Since Universal Analytics was retired in 2023, older Salesforce attribution setups often no longer work as intended. To build reliable revenue attribution today, you need a GA4-based integration that connects customer activity in Salesforce with marketing and website data in Google Analytics.<\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#What_is_%E2%80%9CSalesforce_Google_Analytics_integration%E2%80%9D\" >What is &#8220;Salesforce Google Analytics integration&#8221;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#What_data_you_gain_on_both_sides\" >What data you gain on both sides<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#In_Salesforce_captured_from_the_web\" >In Salesforce (captured from the web)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#In_GA4_sent_from_Salesforce\" >In GA4 (sent from Salesforce)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Why_connecting_Salesforce_to_Google_Analytics_matters\" >Why connecting Salesforce to Google Analytics matters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Prerequisites_checklist\" >Prerequisites checklist<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#The_6_ways_to_connect_Salesforce_to_Google_Analytics_4\" >The 6 ways to connect Salesforce to Google Analytics 4<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_1_Ready-made_AppExchange_app_GA_Connector\" >Method 1: Ready-made AppExchange app (GA Connector)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_2_Web-to-Lead_form_hidden_GA4_Client_ID_field\" >Method 2: Web-to-Lead form + hidden GA4 Client ID field<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_3_GA4_Data_Import_for_Salesforce_data\" >Method 3: GA4 Data Import for Salesforce data<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_4_Measurement_Protocol_via_Salesforce_Flow_HTTP_Callout\" >Method 4: Measurement Protocol via Salesforce Flow HTTP Callout<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_5_Measurement_Protocol_via_Apex_trigger\" >Method 5: Measurement Protocol via Apex trigger<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Method_6_BigQuery_linking\" >Method 6: BigQuery linking<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Connect_Salesforce_to_Google_Analytics_build_vs_managed_integration\" >Connect Salesforce to Google Analytics: build vs. managed integration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Privacy_PII_and_Consent_Mode\" >Privacy, PII, and Consent Mode<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Privacy_PII_and_Consent_Mode-2\" >Privacy, PII, and Consent Mode<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#GA4_reports_you_can_build_after_integration\" >GA4 reports you can build after integration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Common_Salesforce_%E2%86%94_GA4_integration_mistakes\" >Common Salesforce \u2194 GA4 integration mistakes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#The_Salesforce_%E2%86%94_GA4_integration_in_2026\" >The Salesforce \u2194 GA4 integration in 2026<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Salesforce_Google_Analytics_integration_FAQs\" >Salesforce Google Analytics integration FAQs<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Does_Salesforce_integrate_with_Google_Analytics_natively\" >Does Salesforce integrate with Google Analytics natively?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Whats_the_difference_between_GA4_Client_ID_and_User-ID_and_which_should_I_store_in_Salesforce\" >What\u2019s the difference between GA4 Client ID and User-ID, and which should I store in Salesforce?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Can_I_use_Salesforce_Flow_to_call_the_GA4_Measurement_Protocol_or_do_I_need_Apex\" >Can I use Salesforce Flow to call the GA4 Measurement Protocol, or do I need Apex?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Why_are_my_UTM_fields_empty_on_the_Contact_and_Opportunity_after_Lead_conversion\" >Why are my UTM fields empty on the Contact and Opportunity after Lead conversion?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Is_the_Salesforce_%E2%86%94_GA4_integration_GDPR-compliant\" >Is the Salesforce \u2194 GA4 integration GDPR-compliant?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#How_long_does_a_full_Salesforce_%E2%86%94_GA4_integration_take_to_build\" >How long does a full Salesforce \u2194 GA4 integration take to build?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Whats_the_difference_between_GA4_Data_Import_and_Measurement_Protocol_for_Salesforce\" >What\u2019s the difference between GA4 Data Import and Measurement Protocol for Salesforce?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/gaconnector.com\/blog\/salesforce-and-ga4-integration\/#Can_I_import_closed-won_deals_from_Salesforce_as_Google_Ads_conversions\" >Can I import closed-won deals from Salesforce as Google Ads conversions?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_is_%E2%80%9CSalesforce_Google_Analytics_integration%E2%80%9D\"><\/span><strong>What is &#8220;Salesforce Google Analytics integration&#8221;<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A complete Salesforce\u2013GA4 integration works in both directions.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1676 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-scaled.webp\" alt=\"Salesforce - GA4 data flow\" width=\"1920\" height=\"1003\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-300x157.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-1024x535.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-768x401.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-1536x802.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Salesforce-GA4-data-flow-788x412.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p><b>GA4 \u2192 Salesforce:<\/b><span style=\"font-weight: 400;\"> Marketing attribution data such as source, medium, campaign, keyword, landing page, and GA4 Client ID is captured when a lead submits a form and stored in Salesforce. That information should then carry through the entire lifecycle, from Lead to Contact to Opportunity, so attribution data remains available when a deal closes.<\/span><\/p>\n<p><b>Salesforce \u2192 GA4:<\/b><span style=\"font-weight: 400;\"> Key CRM events such as lead qualification, opportunity stage changes, and closed-won deals are sent back to GA4. Using the original Client ID, GA4 can connect revenue and pipeline activity to the marketing channels that generated them.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Many companies only implement the first part. Salesforce receives attribution data, but GA4 never receives revenue data in return. As a result, marketing reports focus on leads while finance reports focus on revenue, and the numbers rarely align.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s also important to understand what this integration is not. This guide focuses on connecting Salesforce Sales Cloud and GA4 for attribution and revenue reporting. It does not cover Marketing Cloud email analytics, Data Cloud, CDPs, or website analytics on their own.<\/span><\/p>\n<p><b>Identifiers matter.<\/b><span style=\"font-weight: 400;\"> The <\/span><b>GA4 Client ID<\/b><span style=\"font-weight: 400;\"> is an anonymous browser identifier used to connect website sessions with CRM records. The <\/span><b>User-ID<\/b><span style=\"font-weight: 400;\"> is a separate identifier defined by your organization, typically based on an internal CRM ID. These two identifiers serve different purposes, and confusing them can lead to broken attribution or privacy compliance issues.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_data_you_gain_on_both_sides\"><\/span><strong>What data you gain on both sides<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"In_Salesforce_captured_from_the_web\"><\/span><strong>In Salesforce (captured from the web)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>GA4 \/ web data<\/b><\/td>\n<td><b>Salesforce custom field<\/b><\/td>\n<td><b>How it\u2019s captured<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GA4 Client ID<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden form field populated by gtag.js<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GA4 Session ID<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GA_Session_ID__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field from ga_session_id<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">utm_source<\/span><\/td>\n<td><span style=\"font-weight: 400;\">UTM_Source__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field from URL parameter<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">utm_medium<\/span><\/td>\n<td><span style=\"font-weight: 400;\">UTM_Medium__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field from URL parameter<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">utm_campaign<\/span><\/td>\n<td><span style=\"font-weight: 400;\">UTM_Campaign__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field from URL parameter<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">utm_term<\/span><\/td>\n<td><span style=\"font-weight: 400;\">UTM_Term__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field from URL parameter<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">gclid (Google Ads)<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GCLID__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hidden field; persisted in cookie<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">First landing page<\/span><\/td>\n<td><span style=\"font-weight: 400;\">First_Landing_Page__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Set on first session; 1st-party cookie<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Referrer<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Referrer__c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">document.referrer at form submit<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"In_GA4_sent_from_Salesforce\"><\/span><strong>In GA4 (sent from Salesforce)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Closed-won revenue<\/b><span style=\"font-weight: 400;\"> \u2013 <\/span><i><span style=\"font-weight: 400;\">closed_won<\/span><\/i><span style=\"font-weight: 400;\"> event via Measurement Protocol, with <\/span><i><span style=\"font-weight: 400;\">value<\/span><\/i><span style=\"font-weight: 400;\">, <\/span><i><span style=\"font-weight: 400;\">currency<\/span><\/i><span style=\"font-weight: 400;\">, and <\/span><i><span style=\"font-weight: 400;\">transaction_id<\/span><\/i><span style=\"font-weight: 400;\">, attributed to the original Client ID. This is the final conversion in the attribution chain \u2013 the revenue event that justifies every marketing dollar spent above it.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>MQL\/SQL transitions<\/b><span style=\"font-weight: 400;\"> \u2013 custom events fired when <\/span><i><span style=\"font-weight: 400;\">Lead.Status<\/span><\/i><span style=\"font-weight: 400;\"> changes, giving GA4 mid-funnel visibility beyond the initial form fill.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Opportunity stage events<\/b><span style=\"font-weight: 400;\"> \u2013 fired when <\/span><i><span style=\"font-weight: 400;\">Opportunity.StageName<\/span><\/i><span style=\"font-weight: 400;\"> advances.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Offline events<\/b><span style=\"font-weight: 400;\"> \u2013 phone outcomes, contract signatures, anything tracked in Salesforce.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">These events reach GA4 via the Measurement Protocol \u2013 GA4\u2019s server-to-server collection API for writing events in, distinct from the Google Analytics Data API (which is for reading google analytics data out). The result: GA4 stops reporting form fills by channel and starts reporting closed-won revenue by channel, campaign, and keyword.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_connecting_Salesforce_to_Google_Analytics_matters\"><\/span><strong>Why connecting Salesforce to Google Analytics matters<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>More accurate marketing ROI.<\/b><span style=\"font-weight: 400;\"> Without a Salesforce integration, GA4 only sees form submissions and other website conversions. It can\u2019t tell which leads became customers or generated revenue. When deal and revenue data flows from Salesforce back into GA4, marketers can measure campaign performance based on actual business outcomes rather than lead volume alone and build a credible <\/span><a href=\"https:\/\/gaconnector.com\/blog\/marketing-attribution\"><span style=\"font-weight: 400;\">marketing attribution<\/span><\/a><span style=\"font-weight: 400;\"> model.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Better Google Ads optimization.<\/b><span style=\"font-weight: 400;\"> When <\/span><i><span style=\"font-weight: 400;\">closed_won<\/span><\/i><span style=\"font-weight: 400;\"> events are sent from Salesforce to GA4 and then shared with Google Ads, bidding algorithms can optimize for high-value customers instead of form fills. This helps advertising platforms focus on the leads most likely to generate revenue rather than the leads most likely to submit a form.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>More reliable attribution.<\/b><span style=\"font-weight: 400;\"> Privacy changes continue to make browser-based tracking less reliable. Capturing the GA4 Client ID when a lead is created in Salesforce and using it throughout the customer journey provides a first-party attribution framework that remains effective even as third-party tracking becomes more limited.<\/span><\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Prerequisites_checklist\"><\/span><strong>Prerequisites checklist<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Confirm these before starting, or you\u2019ll hit a blocker mid-build.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Salesforce edition: Sales Cloud Professional, Enterprise, or Unlimited.<\/b><span style=\"font-weight: 400;\"> Essentials can\u2019t run HTTP Callouts in Flow or Apex \u2013 limited to Methods 1\u20133.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Salesforce permissions: Customize Application + API Enabled.<\/b><span style=\"font-weight: 400;\"> Required to create custom fields and Named Credentials.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>GA4 property with Editor access.<\/b><span style=\"font-weight: 400;\"> Required to create custom dimensions and the Measurement Protocol API secret.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>GA4 Measurement ID<\/b><span style=\"font-weight: 400;\"> (<\/span><i><span style=\"font-weight: 400;\">G-XXXXXXXXXX<\/span><\/i><span style=\"font-weight: 400;\">): GA4 Admin \u2192 Data Streams \u2192 your stream \u2192 top right.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>GA4 Measurement Protocol API secret:<\/b><span style=\"font-weight: 400;\"> Admin \u2192 Data Streams \u2192 your stream \u2192 Measurement Protocol API secrets \u2192 Create. Save it \u2013 you\u2019ll only see it once.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Tag Manager or site code access<\/b><span style=\"font-weight: 400;\"> for the <\/span><i><span style=\"font-weight: 400;\">gtag.js<\/span><\/i> <i><span style=\"font-weight: 400;\">client_id<\/span><\/i><span style=\"font-weight: 400;\"> snippet.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Consent Management Platform<\/b><span style=\"font-weight: 400;\"> (if you have EU traffic) to wire up GA4 Consent Mode before go-live.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"The_6_ways_to_connect_Salesforce_to_Google_Analytics_4\"><\/span><strong>The 6 ways to connect Salesforce to Google Analytics 4<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1673 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-scaled.webp\" alt=\"6 ways to connect salesforce to ga4\" width=\"1920\" height=\"1009\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-300x158.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-1024x538.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-768x404.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-1536x808.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/6-ways-to-connect-salesforce-to-ga4-788x414.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Method<\/b><\/td>\n<td><b>Direction<\/b><\/td>\n<td><b>Complexity<\/b><\/td>\n<td><b>Best for<\/b><\/td>\n<td><b>Trade-offs<\/b><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_1_Ready-made_AppExchange_app_GA_Connector\"><span style=\"font-weight: 400;\">1. Ready-made AppExchange app (GA Connector)<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Two-way<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Low<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Full attribution running fast, no build<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Managed solution (paid); standard SF + GA4 stack<\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_2_Web-to-Lead_form_hidden_GA4_Client_ID_field\"><span style=\"font-weight: 400;\">2. Web-to-Lead + hidden client_id field<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Web \u2192 Salesforce<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Low\u2013Medium<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Capturing the GA4 join key on every Lead<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Last-session only without cross-session logic<\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_3_GA4_Data_Import_for_Salesforce_data\"><span style=\"font-weight: 400;\">3. GA4 Data Import (CSV)<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Salesforce \u2192 GA4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Medium<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Batch enrichment, historical backfills<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Daily-batch; no new Key Events<\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_4_Measurement_Protocol_via_Salesforce_Flow_HTTP_Callout\"><span style=\"font-weight: 400;\">4. Measurement Protocol via Flow HTTP Callout<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Salesforce \u2192 GA4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Medium\u2013High<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Real-time closed-won events \u2013 no Apex<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Named Credential + payload mapping required<\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_5_Measurement_Protocol_via_Apex_trigger\"><span style=\"font-weight: 400;\">5. Measurement Protocol via Apex trigger<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Salesforce \u2192 GA4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">High<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Complex logic, retry handling, audit logging<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requires Apex skills and test coverage<\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#Method_6_BigQuery_linking\"><span style=\"font-weight: 400;\">6. BigQuery + Salesforce warehouse join<\/span><\/a><\/td>\n<td><span style=\"font-weight: 400;\">Two-way analytics<\/span><\/td>\n<td><span style=\"font-weight: 400;\">High<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Custom attribution for mature data teams<\/span><\/td>\n<td><span style=\"font-weight: 400;\">ETL setup; daily-batch; not real-time<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b><i>A note on gtag.js on Salesforce-hosted pages.<\/i><\/b><i><span style=\"font-weight: 400;\"> If what you actually want is GA4 page tracking on Salesforce-hosted pages \u2014 Experience Cloud sites, Site.com pages, or Help portals \u2014 that\u2019s a different task from the attribution integration this guide covers: it moves no CRM data, it just reports those pages into GA4. In that case you\u2019d add the gtag.js snippet to the Salesforce-hosted pages directly, through Experience Builder\u2019s head markup.<\/span><\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_1_Ready-made_AppExchange_app_GA_Connector\"><\/span><b>Method 1: Ready-made AppExchange app (GA Connector)<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The fastest path to a complete Salesforce\u2013GA4 integration, and the right starting point for most teams. Instead of hand-building the capture, field-mapping, and Measurement Protocol layers yourself (Methods 2\u20135), a ready-made AppExchange app installs the whole two-way flow for you.<\/span><\/p>\n<p><b>What it does:<\/b><span style=\"font-weight: 400;\"> GA Connector is a Salesforce AppExchange app that handles the full integration in one package \u2014 attribution field creation on Lead, Contact, and Opportunity; GA4 Client ID capture; lead-conversion field mapping; revenue tracking; and Measurement Protocol events back to GA4. It captures marketing source data on every new record and sends closed-won revenue back to GA4 against the original Client ID, so acquisition reports show revenue by channel, campaign, and keyword instead of form fills.<\/span><\/p>\n<p><b>Setup:<\/b><span style=\"font-weight: 400;\"> Install the app from the Salesforce AppExchange, add the tracking snippet to your site, and connect your GA4 property. No custom fields to build, no Flow or Apex to maintain. Typical setup is a few hours plus testing, versus 1\u20132 weeks for a hand-built stack \u2014 and the app absorbs maintenance when Salesforce or GA4 changes.<\/span><\/p>\n<p><b>Best for:<\/b><span style=\"font-weight: 400;\"> Teams that want full-funnel attribution live quickly on a standard Salesforce Sales Cloud + GA4 + Google Ads stack, without dedicating developer time to a custom build or its upkeep.<\/span><\/p>\n<p><b>What this doesn\u2019t do:<\/b><span style=\"font-weight: 400;\"> It\u2019s a managed (paid) solution rather than a from-scratch build. Teams that need fully custom logic or want to own every line of the integration may prefer Methods 4\u20136.<\/span><\/p>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> Marketing source data lands on every new Lead and persists through to the Opportunity, and every closed-won deal flows back to GA4 with correct attribution \u2014 without a custom build to maintain.<\/span><\/p>\n<p><a href=\"https:\/\/appexchange.salesforce.com\/appxListingDetail?listingId=a0N3A00000FOztzUAD\"><b>Install GA Connector from the Salesforce AppExchange \u2192<\/b><\/a><span style=\"font-weight: 400;\">\u00a0 <\/span><a href=\"https:\/\/gaconnector.com\/contact-us\/\"><b>Book a demo \u2192<\/b><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_2_Web-to-Lead_form_hidden_GA4_Client_ID_field\"><\/span><b>Method 2: Web-to-Lead form + hidden GA4 Client ID field<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The foundational capture step. Every downstream method depends on <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> being populated on the Lead. Skip this and nothing else produces accurate attribution.<\/span><\/p>\n<p><b>Step 1: Create the custom fields on Lead.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Setup \u2192 Object Manager \u2192 Lead \u2192 Fields &amp; Relationships \u2192 New. Create each field from the table above. Non-negotiables: <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\">, <\/span><i><span style=\"font-weight: 400;\">GA_Session_ID__c<\/span><\/i><span style=\"font-weight: 400;\">, and the five UTM fields.<\/span><\/p>\n<p><b>Step 2: Generate the Web-to-Lead form.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Setup \u2192 Web-to-Lead \u2192 Create Web-to-Lead Form. Include the custom fields \u2013 they appear as hidden fields in the generated HTML. Paste the form on your marketing site.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Salesforce Web-to-Lead strips JavaScript. The gtag.js snippet cannot run inside the form. Capture the Client ID on the parent page and write it into the hidden fields before submission \u2013 via a Custom HTML tag in Google Tag Manager, or inline script.<\/span><\/p>\n<p><b>Step 3: Populate Client ID and Session ID via gtag.js.<\/b><\/p>\n<pre class=\"\">gtag('get', 'G-XXXXXXXXXX', 'client_id', function(clientId) {\r\ndocument.getElementById('ga_client_id').value = clientId;\r\n});\r\n\r\ngtag('get', 'G-XXXXXXXXXX', 'session_id', function(sessionId) {\r\ndocument.getElementById('ga_session_id').value = sessionId;\r\n});<\/pre>\n<p><span style=\"font-weight: 400;\">Replace <\/span><i><span style=\"font-weight: 400;\">G-XXXXXXXXXX<\/span><\/i><span style=\"font-weight: 400;\"> with your Measurement ID. Match <\/span><i><span style=\"font-weight: 400;\">getElementById<\/span><\/i><span style=\"font-weight: 400;\"> values to the hidden field IDs in your Web-to-Lead HTML.<\/span><\/p>\n<p><b>Step 4: Add cross-session UTM persistence.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Reading UTMs from the current URL only captures last-session data. The fix: write UTMs to a first-party cookie on first visit; read that cookie into the hidden UTM fields at form submit. See the <\/span><a href=\"https:\/\/gaconnector.com\/blog\/tracking-utm-parameters-in-salesforce-web-to-lead-forms\/\"><span style=\"font-weight: 400;\">Salesforce UTM tracking guide<\/span><\/a><span style=\"font-weight: 400;\"> for the full implementation.<\/span><\/p>\n<p><b>Step 5: Configure Lead Conversion field mapping.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The most-skipped step. Salesforce does not copy custom Lead fields to Contact or Opportunity at conversion. Configure it manually: Setup \u2192 Object Manager \u2192 Lead \u2192 Map Lead Fields. Without this, <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> and all UTM fields are present on the Lead and absent on Contact and Opportunity \u2013 every Measurement Protocol event then fires attributed to <\/span><i><span style=\"font-weight: 400;\">(direct)\/(none)<\/span><\/i><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Step 6: Test.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Submit a test form with UTMs in the URL. Open the new Lead \u2013 verify all fields populated. Convert the Lead manually \u2013 verify the same fields appear on the Contact and Opportunity.<\/span><\/p>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> Every new Lead has GA4 and UTM fields populated at creation. Those fields persist through Lead \u2192 Contact \u2192 Opportunity conversion automatically.<\/span><\/p>\n<p><b>Skip the manual field build.<\/b><span style=\"font-weight: 400;\"> GA Connector ships all these fields pre-configured and the <\/span><i><span style=\"font-weight: 400;\">client_id<\/span><\/i><span style=\"font-weight: 400;\"> capture logic pre-built. <\/span><a href=\"https:\/\/appexchange.salesforce.com\/appxListingDetail?listingId=a0N3A00000FOztzUAD\"><span style=\"font-weight: 400;\">Install from the Salesforce AppExchange \u2192<\/span><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_3_GA4_Data_Import_for_Salesforce_data\"><\/span><b>Method 3: GA4 Data Import for Salesforce data<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Batch enrichment. Still useful; not the right answer for real-time attribution.<\/span><\/p>\n<p><b>What it does:<\/b><span style=\"font-weight: 400;\"> Upload a CSV of Salesforce data into GA4 via Admin \u2192 Data Import. GA4 joins rows to existing events using <\/span><i><span style=\"font-weight: 400;\">client_id<\/span><\/i><span style=\"font-weight: 400;\"> as the key. Imported fields become custom dimensions in reports.<\/span><\/p>\n<p><b>Setup:<\/b><span style=\"font-weight: 400;\"> Build a Salesforce report including <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> and the dimensions to import. Export as CSV \u2013 open in a text editor, not Excel (Excel reformats long numeric strings and breaks the join). Format per GA4\u2019s Data Import schema: first column <\/span><i><span style=\"font-weight: 400;\">client_id<\/span><\/i><span style=\"font-weight: 400;\">, remaining columns are user properties. Upload at GA4 Admin \u2192 Data Import \u2192 Create data source.<\/span><\/p>\n<p><b>Key limits:<\/b><span style=\"font-weight: 400;\"> Daily-batch only. Data Import enriches existing events \u2013 it does not create new Key Events. <\/span><i><span style=\"font-weight: 400;\">Closed Won<\/span><\/i><span style=\"font-weight: 400;\"> won\u2019t feed Smart Bidding from Data Import alone. And if <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> isn\u2019t on the Lead (Method 2 was skipped), there\u2019s nothing to join on.<\/span><\/p>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> Lead Status and Opportunity Stage available as custom dimensions in GA4 Acquisition reports, so you can segment MQLs and SQLs by source.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_4_Measurement_Protocol_via_Salesforce_Flow_HTTP_Callout\"><\/span><b>Method 4: Measurement Protocol via Salesforce Flow HTTP Callout<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1674 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-scaled.webp\" alt=\"GA4 measurement protocol\" width=\"1920\" height=\"1006\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-300x157.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-1024x536.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-768x402.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-1536x804.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-measurement-protocol-788x413.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The recommended method for most teams. HTTP Callouts in Flow have been generally available since Winter \u201924 for POST requests \u2013 <\/span><b>no Apex required<\/b><span style=\"font-weight: 400;\">. A Salesforce admin can build and maintain this.<\/span><\/p>\n<p><b>Step 1: Create the Named Credential.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Setup \u2192 Named Credentials \u2192 New Named Credential.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Label: <\/span><i><span style=\"font-weight: 400;\">GA4 Measurement Protocol<\/span><\/i><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">URL: <\/span><i><span style=\"font-weight: 400;\">https:\/\/www.google-analytics.com\/mp\/collect<\/span><\/i><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Authentication: Anonymous (auth is via <\/span><i><span style=\"font-weight: 400;\">api_secret<\/span><\/i><span style=\"font-weight: 400;\"> query parameter)<\/span><\/li>\n<\/ul>\n<p><b>Step 2: Store credentials as Custom Settings.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Create a Custom Setting for <\/span><i><span style=\"font-weight: 400;\">measurement_id<\/span><\/i><span style=\"font-weight: 400;\"> and <\/span><i><span style=\"font-weight: 400;\">api_secret<\/span><\/i><span style=\"font-weight: 400;\">. Never hardcode either in the Flow. Rotate the API secret quarterly.<\/span><\/p>\n<p><b>Step 3: Build the Record-Triggered Flow.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Setup \u2192 Flow \u2192 New Flow \u2192 Record-Triggered Flow. Object: Opportunity. Trigger: record is updated. Entry condition: <\/span><i><span style=\"font-weight: 400;\">StageName<\/span><\/i><span style=\"font-weight: 400;\"> Equals <\/span><i><span style=\"font-weight: 400;\">Closed Won<\/span><\/i><span style=\"font-weight: 400;\">. Set the \u201conly when record transitions into meeting the condition\u201d flag \u2013 otherwise it fires on every save<\/span><\/p>\n<p><b>Step 4: Get the related Contact.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Add a Get Records element to retrieve the primary Contact and its <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> field \u2013 this was mapped from the Lead in Method 2.<\/span><\/p>\n<p><b>Step 5: Add the HTTP Callout Action.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Action: HTTP Callout<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Method: POST<\/span><\/p>\n<p><span style=\"font-weight: 400;\">URL: Named Credential URL appended with <\/span><i><span style=\"font-weight: 400;\">?measurement_id={!CustomSetting.Measurement_ID__c}&amp;api_secret={!CustomSetting.API_Secret__c}.<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">Header: <\/span><i><span style=\"font-weight: 400;\">Content-Type: application\/json<\/span><\/i><\/p>\n<p><span style=\"font-weight: 400;\">Body:<\/span><\/p>\n<pre class=\"\">{\r\n\"client_id\": \"{!relatedContact.GA_Client_ID__c}\",\r\n\"events\": [{\r\n\"name\": \"closed_won\",\r\n\"params\": {\r\n\"value\": \"{!Opportunity.Amount}\",\r\n\"currency\": \"USD\",\r\n\"transaction_id\": {!Opportunity.Id},\r\n\"session_id\": \"{!relatedContact.GA_Session_ID__c}\"\r\n}\r\n}]\r\n}<\/pre>\n<p><span style=\"font-weight: 400;\">Add a Conversion_Sent__c checkbox field on Opportunity as a Salesforce-side guard \u2013 check it before firing, set it to true after.<\/span><\/p>\n<p><b>Step 6: Mark as Key Event in GA4.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">GA4 \u2192 Admin \u2192 Events \u2192 <\/span><i><span style=\"font-weight: 400;\">closed_won<\/span><\/i><span style=\"font-weight: 400;\"> \u2192 toggle \u201cMark as key event.\u201d Without this, it won\u2019t appear in conversion reports or feed Google Ads Smart Bidding.<\/span><\/p>\n<p><b>Step 7: Test.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Run with debug logging on a sandbox Opportunity at Closed-Won stage. The HTTP Callout returns HTTP 204 \u2013 Measurement Protocol\u2019s success status; no response body. Check GA4 Realtime for <\/span><i><span style=\"font-weight: 400;\">closed_won<\/span><\/i><span style=\"font-weight: 400;\">, then wait 24\u201348 hours to confirm it appears in Acquisition reports with correct source\/medium attribution.<\/span><\/p>\n<p><b>Failure modes:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No <\/span><i><span style=\"font-weight: 400;\">client_id<\/span><\/i><span style=\"font-weight: 400;\"> on the Contact \u2192 event fires attributed to <\/span><i><span style=\"font-weight: 400;\">(direct)\/(none)<\/span><\/i><span style=\"font-weight: 400;\">. Verify Method 2 populated the Lead field.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">PII in the payload \u2013 never include email, phone, or name. <\/span><i><span style=\"font-weight: 400;\">Opportunity.Id<\/span><\/i><span style=\"font-weight: 400;\"> and <\/span><i><span style=\"font-weight: 400;\">Contact.Id<\/span><\/i><span style=\"font-weight: 400;\"> are safe.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Rapid stage changes double-fire \u2013 <\/span><i><span style=\"font-weight: 400;\">Conversion_Sent__c<\/span><\/i><span style=\"font-weight: 400;\"> guard both prevent this.<\/span><\/li>\n<\/ul>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> Every Closed-Won Opportunity fires a <\/span><i><span style=\"font-weight: 400;\">closed_won<\/span><\/i><span style=\"font-weight: 400;\"> event to GA4 within seconds. See the <\/span><a href=\"https:\/\/gaconnector.com\/blog\/closed-loop-marketing-for-salesforce\/\"><span style=\"font-weight: 400;\">closed-loop marketing for Salesforce guide<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/gaconnector.com\/blog\/closed-loop-reporting\/\"><span style=\"font-weight: 400;\">closed-loop reporting guide<\/span><\/a><span style=\"font-weight: 400;\"> for next steps. For the complete attribution picture, see the <\/span><a href=\"https:\/\/gaconnector.com\/blog\/full-funnel-attribution-guide\/\"><span style=\"font-weight: 400;\">full-funnel attribution guide<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_5_Measurement_Protocol_via_Apex_trigger\"><\/span><b>Method 5: Measurement Protocol via Apex trigger<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">For teams with Apex skills and requirements Flow can\u2019t handle cleanly: retry-on-failure with exponential backoff, batching multiple events per request, logging every callout to a custom object for audit\/compliance, or conditional logic across many field combinations.<\/span><\/p>\n<p><b>Structure:<\/b><span style=\"font-weight: 400;\"> Apex trigger on Opportunity (<\/span><i><span style=\"font-weight: 400;\">after update<\/span><\/i><span style=\"font-weight: 400;\">) detects <\/span><i><span style=\"font-weight: 400;\">StageName<\/span><\/i><span style=\"font-weight: 400;\"> transition to Closed-Won \u2192 calls a <\/span><i><span style=\"font-weight: 400;\">@future(callout=true)<\/span><\/i><span style=\"font-weight: 400;\"> or Queueable method \u2192 builds the Measurement Protocol JSON (identical payload to Method 4) \u2192 fires via <\/span><i><span style=\"font-weight: 400;\">Http.send()<\/span><\/i><span style=\"font-weight: 400;\">. Named Credential for the endpoint; Custom Settings for credentials. Test class with a mocked <\/span><i><span style=\"font-weight: 400;\">HttpCalloutMock<\/span><\/i><span style=\"font-weight: 400;\"> response.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Measurement Protocol POST itself is simple. Most teams choose Apex over Flow for organizational reasons rather than because Flow is insufficient. If you don\u2019t have a specific requirement for Apex, Method 4 is faster to build and easier to maintain.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Reference: <\/span><a href=\"https:\/\/developer.salesforce.com\/docs\/atlas.en-us.apexcode.meta\/apexcode\/apex_callouts.htm\"><span style=\"font-weight: 400;\">Salesforce Apex HTTP Callout documentation<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> Same outcome as Method 4 \u2013 closed-won events in GA4 with correct attribution \u2013 plus Apex-level retry logic and a full audit trail.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Method_6_BigQuery_linking\"><\/span><b>Method 6: BigQuery linking<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">For teams with a data warehouse and custom attribution requirements.<\/span><\/p>\n<p><b>What it does:<\/b><span style=\"font-weight: 400;\"> Link GA4 to BigQuery (GA4 Admin \u2192 BigQuery Links \u2192 Link). GA4 exports raw event data daily into BigQuery. ETL Salesforce data in via Fivetran, Airbyte, or Salesforce\u2019s native BigQuery Data Cloud connector. Join on <\/span><i><span style=\"font-weight: 400;\">user_pseudo_id<\/span><\/i><span style=\"font-weight: 400;\"> (GA4\u2019s Client ID in BigQuery) and <\/span><i><span style=\"font-weight: 400;\">GA_Client_ID__c<\/span><\/i><span style=\"font-weight: 400;\"> in SQL.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Use Daily export for attribution work \u2013 Streaming drops attribution fields for new users. Partition GA4 tables by <\/span><i><span style=\"font-weight: 400;\">_TABLE_SUFFIX<\/span><\/i><span style=\"font-weight: 400;\">; without partition pruning, queries on large event tables get expensive fast.<\/span><\/p>\n<p><b>Right for:<\/b><span style=\"font-weight: 400;\"> Custom attribution models; cross-platform reporting across GA4, Google Ads, and Salesforce in one query; teams already operating a data warehouse for digital analytics work. Companies that use this layer to deliver exceptional customer experiences do so by understanding cohort behavior at the instance level \u2013 something GA4\u2019s built-in reports can\u2019t provide.<\/span><\/p>\n<p><b>Overkill for:<\/b><span style=\"font-weight: 400;\"> Most SMBs without a dedicated data engineer. Methods 4\u20135 solve the revenue-back-to-GA4 problem without the warehouse overhead.<\/span><\/p>\n<p><b>Done looks like:<\/b><span style=\"font-weight: 400;\"> A unified BigQuery dataset where SQL queries join GA4 events to Salesforce records, feeding Looker Studio dashboards that agree with Salesforce reports.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Connect_Salesforce_to_Google_Analytics_build_vs_managed_integration\"><\/span><strong>Connect Salesforce to Google Analytics: build vs. managed integration<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><b>Build your own integration if:<\/b><span style=\"font-weight: 400;\"> You have Salesforce and developer resources available, need custom logic or workflows that off-the-shelf tools can\u2019t support, or want complete control over how data is stored, processed, and analyzed.<\/span><\/p>\n<p><b>Use a managed integration if:<\/b><span style=\"font-weight: 400;\"> You\u2019re a small or mid-sized business, want attribution reporting up and running quickly, and use a standard stack such as Salesforce Sales Cloud, GA4, and Google Ads. For many teams, the value of faster implementation and cleaner data outweighs the cost of a managed solution.<\/span><\/p>\n<p><b>Where GA Connector fits.<\/b><span style=\"font-weight: 400;\"> GA Connector is a Salesforce AppExchange solution designed to simplify the Salesforce\u2013GA4 integration process. It handles attribution field creation, Client ID capture, lead conversion mapping, revenue tracking, and Measurement Protocol events without requiring a custom build. It also reduces the maintenance burden by handling updates when Salesforce or GA4 changes. See the <\/span><a href=\"https:\/\/gaconnector.com\/blog\/the-easiest-way-to-implement-marketing-attribution-in-salesforce\/\"><span style=\"font-weight: 400;\">full Salesforce attribution walkthrough<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/gaconnector.com\/docs\/salesforce-to-ga4-overview\/\"><span style=\"font-weight: 400;\">GA Connector Salesforce docs<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Enterprise alternative.<\/b><span style=\"font-weight: 400;\"> Large organizations with dedicated analytics and attribution teams often use enterprise platforms such as Adobe Marketo Measure (formerly Bizible). These solutions provide advanced attribution capabilities but typically come with significantly higher implementation and subscription costs.See the <\/span><a href=\"https:\/\/gaconnector.com\/blog\/ga-connector-an-affordable-bizible-alternative-for-marketing-attribution\/\"><span style=\"font-weight: 400;\">Bizible alternative overview<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/gaconnector.com\/blog\/ga-connector-an-affordable-pardot-alternative-for-marketing-attribution\/\"><span style=\"font-weight: 400;\">Pardot alternative overview<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><a href=\"https:\/\/appexchange.salesforce.com\/appxListingDetail?listingId=a0N3A00000FOztzUAD\"><b>Install GA Connector from the Salesforce AppExchange \u2192<\/b><\/a><span style=\"font-weight: 400;\">\u00a0 <\/span><a href=\"https:\/\/gaconnector.com\/contact-us\/\"><b>Book a demo \u2192<\/b><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1675 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-scaled.webp\" alt=\"What each platform learns from each other\" width=\"1920\" height=\"1005\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-300x157.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-1024x536.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-768x402.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-1536x804.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/What-each-platform-learns-from-each-other-788x412.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Privacy_PII_and_Consent_Mode\"><\/span><strong>Privacy, PII, and Consent Mode<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Privacy_PII_and_Consent_Mode-2\"><\/span><b>Privacy, PII, and Consent Mode<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><b>The most important rule:<\/b><span style=\"font-weight: 400;\"> Never send personally identifiable information (PII) to GA4. This includes email addresses, phone numbers, names, postal addresses, and similar data. PII should never be included in Client IDs, User-IDs, event parameters, or <\/span><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/protocol\/ga4\"><span style=\"font-weight: 400;\">Measurement Protocol<\/span><\/a><span style=\"font-weight: 400;\"> requests.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Salesforce record IDs, such as Opportunity IDs and Contact IDs, can be used safely because they do not directly identify an individual. If you use GA4 User-ID, use an internal identifier or a hashed value rather than a raw email address.<\/span><\/p>\n<p><b>GDPR considerations.<\/b><span style=\"font-weight: 400;\"> While the GA4 Client ID is not considered PII under Google\u2019s policies, it may still be treated as personal data under GDPR because it can be linked to an individual over time. Organizations should document the integration in their data processing records and have a process for handling user deletion requests.<\/span><\/p>\n<p><b>Consent Mode.<\/b><span style=\"font-weight: 400;\"> If you operate in regions where consent is required, such as the EU, GA4 Consent Mode should be configured before launching the integration. Consent settings affect how identifiers are stored and how attribution data is collected and reported.<\/span><\/p>\n<p><b>Generally safe to send:<\/b><span style=\"font-weight: 400;\"> Client ID, Session ID, event names, revenue values, currencies, transaction IDs, and Salesforce record IDs.<\/span><\/p>\n<p><b>Do not send:<\/b><span style=\"font-weight: 400;\"> Email addresses, phone numbers, names, addresses, IP addresses, or any other information that can directly identify an individual.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"GA4_reports_you_can_build_after_integration\"><\/span><strong>GA4 reports you can build after integration<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><b>Closed-won revenue by source and medium.<\/b><span style=\"font-weight: 400;\"> Once Salesforce revenue data is flowing into GA4, acquisition reports can show which channels generate actual revenue rather than just leads or form submissions. This gives you a much more accurate view of marketing ROI.<\/span><\/p>\n<p><b>Closed-won revenue by campaign and keyword.<\/b><span style=\"font-weight: 400;\"> Campaign and keyword reports become far more valuable when they include deal value and revenue. Instead of optimizing for clicks or conversions, you can identify the campaigns that generate customers and revenue.<\/span><\/p>\n<p><b>Lead progression by traffic source.<\/b><span style=\"font-weight: 400;\"> By sending lead status updates from Salesforce to GA4, you can analyze how leads move through the funnel by channel. This helps reveal which sources generate qualified opportunities and which generate leads that never progress.<\/span><\/p>\n<p><b>Google Ads optimization based on revenue.<\/b><span style=\"font-weight: 400;\"> When closed-won deals are tracked as GA4 conversions and imported into Google Ads, Smart Bidding can optimize toward revenue rather than form fills. For many B2B companies, this is one of the most valuable outcomes of a Salesforce\u2013GA4 integration.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Many managed solutions also provide pre-built dashboards and reports, making it easier to start analyzing revenue attribution without building every report from scratch.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1677 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-scaled.webp\" alt=\"GA4 reports before and after\" width=\"1920\" height=\"1004\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-300x157.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-1024x535.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-768x401.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-1536x803.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/GA4-reports-before-and-after-788x412.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Common_Salesforce_%E2%86%94_GA4_integration_mistakes\"><\/span><strong>Common Salesforce \u2194 GA4 integration mistakes<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><b>Not capturing the GA4 Client ID when a lead is created.<\/b><span style=\"font-weight: 400;\"> The Client ID is what connects website activity to Salesforce records. If it isn\u2019t stored on the lead, attribution becomes much harder later in the process.<\/span><\/p>\n<p><b>Missing Lead-to-Contact and Opportunity field mapping.<\/b><span style=\"font-weight: 400;\"> Custom attribution fields do not automatically transfer during lead conversion. If mapping is not configured correctly, valuable attribution data can be lost before a deal closes. See the <\/span><a href=\"https:\/\/gaconnector.com\/docs\/mapping-ga-connector-lead-fields-to-accounts-opportunities-and-contacts-in-salesforce\/\"><span style=\"font-weight: 400;\">mapping documentation<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><b>Tracking only the most recent UTM values.<\/b><span style=\"font-weight: 400;\"> Customers often interact with multiple campaigns before converting. Storing only the last touchpoint creates an incomplete picture of the customer journey.<\/span><\/p>\n<p><b>Sending personal information to GA4.<\/b><span style=\"font-weight: 400;\"> Email addresses, phone numbers, and other personally identifiable information should never be used as User-IDs or sent through event parameters.<\/span><\/p>\n<p><b>Using outdated Salesforce automation tools.<\/b><span style=\"font-weight: 400;\"> New integrations should rely on Salesforce Flow or custom development rather than older automation features that are being phased out.<\/span><\/p>\n<p><b>Poor credential management.<\/b><span style=\"font-weight: 400;\"> API keys and secrets should be stored securely and reviewed regularly instead of being hardcoded into scripts or workflows.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1678 size-full\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-scaled.webp\" alt=\"Most common Salesforce - GA4 integration mistakes\" width=\"1920\" height=\"1016\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-scaled.webp 1920w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-300x159.webp 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-1024x542.webp 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-768x406.webp 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-1536x813.webp 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2022\/05\/Most-common-Salesforce-GA4-integration-mistakes-788x417.webp 788w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p><b>Not preventing duplicate events.<\/b><span style=\"font-weight: 400;\"> Without proper safeguards, the same opportunity or revenue event can be sent to GA4 multiple times, leading to inflated conversion and revenue reporting.<\/span><\/p>\n<p><b>Forgetting to configure GA4 conversions.<\/b><span style=\"font-weight: 400;\"> Sending events to GA4 is only part of the process. Revenue and pipeline events must also be marked as key events (conversions) to appear in reporting and support tools such as Google Ads Smart Bidding.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_Salesforce_%E2%86%94_GA4_integration_in_2026\"><\/span><strong>The Salesforce \u2194 GA4 integration in 2026<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Connecting Salesforce and GA4 is no longer a simple data import project. A complete setup typically combines several components: website tracking, Client ID capture, attribution field mapping, offline conversion tracking, revenue reporting, and advanced analytics. Most organizations use multiple integration methods together rather than relying on a single solution.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The right approach depends on your Salesforce setup, available technical resources, and reporting requirements. Some teams need real-time revenue and pipeline updates, while others are well served by daily data synchronization and reporting.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For SMBs looking for a faster path to full-funnel attribution, managed solutions can significantly reduce implementation time. GA Connector, for example, provides Client ID capture, attribution field management, revenue tracking, and GA4 event syncing in a single package, helping teams move from lead reporting to revenue reporting without building and maintaining a custom integration stack.<\/span><\/p>\n<p><a href=\"https:\/\/appexchange.salesforce.com\/appxListingDetail?listingId=a0N3A00000FOztzUAD\"><b>Install GA Connector from the Salesforce AppExchange \u2192<\/b><\/a><span style=\"font-weight: 400;\">\u00a0 <\/span><a href=\"https:\/\/gaconnector.com\/contact-us\/\"><b>Book a demo \u2192<\/b><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Salesforce_Google_Analytics_integration_FAQs\"><\/span><strong>Salesforce Google Analytics integration FAQs<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Does_Salesforce_integrate_with_Google_Analytics_natively\"><\/span><strong>Does Salesforce integrate with Google Analytics natively?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">No. There is no official Salesforce \u2194 GA4 connector in either platform \u2013 the integration requires stitching together the six methods in this guide, or using a managed AppExchange package like GA Connector.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Whats_the_difference_between_GA4_Client_ID_and_User-ID_and_which_should_I_store_in_Salesforce\"><\/span><b>What\u2019s the difference between GA4 Client ID and User-ID, and which should I store in Salesforce?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Client ID is GA4\u2019s auto-generated browser identifier (stored in _ga, not PII under Google\u2019s ToS) \u2013 store it as GA_Client_ID__c on Lead, Contact, and Opportunity as the primary join key. User-ID is one you supply (use Salesforce Contact.Id or a SHA-256 hash of the email; never the raw email).<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_use_Salesforce_Flow_to_call_the_GA4_Measurement_Protocol_or_do_I_need_Apex\"><\/span><b>Can I use Salesforce Flow to call the GA4 Measurement Protocol, or do I need Apex?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Flow is sufficient for most teams \u2013 HTTP Callout Actions have been GA since Winter \u201924. Choose Apex only if you need retry-on-failure logic, batching, or audit logging to a custom Salesforce object.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Why_are_my_UTM_fields_empty_on_the_Contact_and_Opportunity_after_Lead_conversion\"><\/span><b>Why are my UTM fields empty on the Contact and Opportunity after Lead conversion?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Salesforce doesn\u2019t automatically copy custom Lead fields at conversion \u2013 only standard fields transfer. Configure Lead Conversion field mapping at Setup \u2192 Object Manager \u2192 Lead \u2192 Map Lead Fields, creating matching fields on Contact and Opportunity first.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Is_the_Salesforce_%E2%86%94_GA4_integration_GDPR-compliant\"><\/span><b>Is the Salesforce \u2194 GA4 integration GDPR-compliant?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Yes, if built correctly: keep PII inside Salesforce, send only Client ID and Salesforce record IDs in Measurement Protocol payloads, configure Consent Mode for EU traffic, document the integration in your GDPR Records of Processing Activities, and build a deletion path using GA4\u2019s User Deletion API.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_long_does_a_full_Salesforce_%E2%86%94_GA4_integration_take_to_build\"><\/span><b>How long does a full Salesforce \u2194 GA4 integration take to build?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Methods 1\u20134 take 1\u20132 weeks for a competent Salesforce admin; Apex (Method 5) adds a week; BigQuery (Method 6) adds 2\u20134 weeks from scratch. GA Connector compresses this to a few hours of install plus 1\u20132 days of testing.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Whats_the_difference_between_GA4_Data_Import_and_Measurement_Protocol_for_Salesforce\"><\/span><b>What\u2019s the difference between GA4 Data Import and Measurement Protocol for Salesforce?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Data Import is daily-batch CSV enrichment that adds Salesforce dimensions to existing GA4 events but can\u2019t create new Key Events or feed Smart Bidding. Measurement Protocol fires real-time events that create Key Events in GA4 and can feed Google Ads bidding \u2013 the right choice for revenue attribution.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_import_closed-won_deals_from_Salesforce_as_Google_Ads_conversions\"><\/span><b>Can I import closed-won deals from Salesforce as Google Ads conversions?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Yes \u2013 once closed_won is a Key Event in GA4, import it into Google Ads at Tools \u2192 Conversions \u2192 Import \u2192 From Google Analytics 4, enabling Smart Bidding to optimize for closed-won deal value instead of form fills.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your GA4 dashboard shows 800 conversions last month. Your Salesforce Opportunities report shows 64 closed-won deals worth $720k. Nowhere in either tool can you see which of those 800 became which of those 64 \u2013 or which campaign earned the $180k deal that closed last Tuesday. That\u2019s the Salesforce Google Analytics integration problem. The Salesforce&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"yst_prominent_words":[325,73,630,21,45,16,163,39,336],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/1046"}],"collection":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/comments?post=1046"}],"version-history":[{"count":11,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/1046\/revisions"}],"predecessor-version":[{"id":1698,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/1046\/revisions\/1698"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/media?parent=1046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/categories?post=1046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/tags?post=1046"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=1046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}