{"id":212,"date":"2017-05-26T19:51:46","date_gmt":"2017-05-26T19:51:46","guid":{"rendered":"https:\/\/gaconnector.com\/blog\/?p=212"},"modified":"2024-01-09T10:51:11","modified_gmt":"2024-01-09T10:51:11","slug":"salesforce-google-analytics-integration-guide","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/blog\/salesforce-google-analytics-integration-guide\/","title":{"rendered":"How to Integrate Salesforce Data into Google Analytics 4"},"content":{"rendered":"<p><em><strong>This detailed step-by-step guide will show you how to integrate Salesforce.com with Google Analytics 4.<\/strong><\/em><\/p>\n<h2>What Will a Salesforce and Google Analytics 4 Integration Do For You?<\/h2>\n<p>The goal of marketing is to drive revenue.<\/p>\n<p>But Google Analytics 4 is only good at measuring <strong>sales that happened right on the website<\/strong>\u00a0(e.g. an e-commerce store).<\/p>\n<p>But\u00a0most businesses don\u2019t work this way.<\/p>\n<p><span style=\"font-weight: 400;\">Sales are often<\/span> closed by sales reps and only tracked in Salesforce or some other CRM software.<\/p>\n<p><span style=\"font-weight: 400;\">If you only capture what your customers do on your website, you\u2019re missing out.<\/span><\/p>\n<p>You don\u2019t know <strong>how many of your website visitors actually became paying customers<\/strong>.<\/p>\n<h2>The Method<\/h2>\n<p>In this article, we will\u00a0provide a step-by-step method for <strong>bringing information about your buyers from Salesforce into Google Analytics 4<\/strong>.<\/p>\n<p>We\u2019ll utilize a really cool Google Analytics 4 feature called Data Import to pass customers\u2019 lead information from Salesforce into Google Analytics 4. In this particular article, we will explain how to import Lead Status data into Google Analytics 4.<\/p>\n<p><span style=\"font-weight: 400;\">Once you do this<\/span> you\u2019ll be able to build interesting Google Analytics 4 reports with Salesforce data, like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1371\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example.png\" alt=\"Salesforce Google Analytics integration result example\" width=\"2130\" height=\"944\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example.png 2130w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-300x133.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-1024x454.png 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-768x340.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-1536x681.png 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-2048x908.png 2048w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-788x349.png 788w\" sizes=\"(max-width: 2130px) 100vw, 2130px\" \/><\/p>\n<h2>Overview of<b>\u00a0Implementing<\/b> of Salesforce &amp; Google Analytics 4 Integration<\/h2>\n<p>To import Salesforce data into Google Analytics 4, we need a key that will unite CRM and Analytics data. We\u2019re going to use the Google Analytics Client ID \u2013 a cookie generated by Google Analytics 4 for each browser viewing your website.<\/p>\n<p>This key will be tracked in Google Analytics 4, and stored in Salesforce \u2013 as a custom field.<\/p>\n<p><strong>This integration takes only five simple steps.<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"text-decoration: underline;\">In steps 1-2<\/span><\/span><span style=\"font-weight: 400;\">, we\u2019re going to create lead status as a custom dimension, then save the client ID to Salesforce as a custom field.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Then, <span style=\"text-decoration: underline;\">in steps 3-4<\/span><\/span><span style=\"font-weight: 400;\"> we will use GA Data Import to automatically merge this data in Google Analytics 4.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Finally, <span style=\"text-decoration: underline;\">in step 5<\/span><\/span><span style=\"font-weight: 400;\"> you\u2019ll find your Salesforce data in Google Analytics 4 and learn how to use it.<\/span><\/p>\n<h2>Key Results<\/h2>\n<p>When you bring Lead Statuses from Salesforce into Google Analytics 4, you\u2019ll be able to build all kinds of reports with this data to answer questions like:<\/p>\n<ul>\n<li><strong>Which campaigns, ads, blog posts and keywords<\/strong> drive the most qualified leads?<\/li>\n<li><strong>Which traffic sources only\u00a0drive junk traffic<\/strong> that distracts your sales reps from valuable customers that your company can actually help?<\/li>\n<li><strong>How is the behavior of your qualified leads<\/strong> on your website different from that of your unqualified leads? (this question can be answered by building two segments and comparing them)<\/li>\n<li><strong>What pages<\/strong> <span style=\"font-weight: 400;\">do your qualified leads visit most frequently<\/span>? (you may want to focus more of your attention on those)<\/li>\n<\/ul>\n<h2>Step One: Create Custom Dimensions<\/h2>\n<p>1. Go to your Google Analytics 4 property, and click Admin \u2013 Custom Definitions \u2013 Custom Dimensions.<\/p>\n<p>2. You should see something like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1374\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1.png\" alt=\"Custom Dimensions\" width=\"1465\" height=\"286\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1.png 1465w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1-300x59.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1-1024x200.png 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1-768x150.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Custom-Dimensions-1-788x154.png 788w\" sizes=\"(max-width: 1465px) 100vw, 1465px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>3. Click <strong>New Custom Dimension<\/strong>\u00a0and create a new user-level custom dimension like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1375 alignnone\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Lead-Status.jpg\" alt=\"Lead Status\" width=\"756\" height=\"380\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Lead-Status.jpg 756w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Lead-Status-300x151.jpg 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>4. <strong><b>Remember the name of this new custom dimension<\/b><span style=\"font-weight: 400;\">(from the user property field). We\u2019ll need it in step 2.<\/span><\/strong><\/p>\n<h2><b>Step Two: Save Google Analytics Client ID to Salesforce<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Now we need to save the Google Analytics Client ID to Salesforce, so we can use it as a key when merging data.<\/span><\/p>\n<p>To\u00a0do this:<\/p>\n<p>1. Add a new custom field to your Salesforce Lead object.<\/p>\n<p>2. Then, create a new hidden form field and connect it to the new custom field.<\/p>\n<p><span style=\"font-weight: 400;\">This saves the value of the hidden field to Salesforce during form submission.<\/span><\/p>\n<p>The hidden field should look something like this:<\/p>\n<pre class=\"lang:default decode:true \">&lt;input type='hidden' id='ga_client_id' name='ga_client_id'&gt;<\/pre>\n<p>3. Finally, add code\u00a0resembling this to your website:<\/p>\n<pre class=\"lang:default decode:true\">\/\/ Retrieve the GA4 client ID, replace 'GA4_PROPERTY_ID' with your property ID\r\nconst clientId = gtag.get('GA4_PROPERTY_ID', 'client_id');\r\ndocument.getElementById('ga_client_id').value = clientId;<\/pre>\n<p>This code will automatically retrieve the value of the GA Client ID and put it in\u00a0the\u00a0new hidden field we just created.<\/p>\n<h2>Step Three: Create a Data Set File with Salesforce Data<\/h2>\n<p>Now we just need to fill this file with actual data from Salesforce.<\/p>\n<p>To do this,\u00a0open Salesforce navigate to Reports and create a new lead report. Then, export this report as a CSV file:<\/p>\n<div style=\"width: 1328px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/pasted-image-0-2.png\" alt=\"Salesforce export menu (to generate a file for Google Analytics import)\" width=\"1318\" height=\"424\" \/><p class=\"wp-caption-text\">Salesforce export menu (to generate a file for Google Analytics import)<\/p><\/div>\n<p>Now update the exported CSV file to match the Google Analytics 4 requirements. The CSV file should look something like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1376 alignnone\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/CSV-Format.png\" alt=\"CSV Format\" width=\"659\" height=\"339\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/CSV-Format.png 659w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/CSV-Format-300x154.png 300w\" sizes=\"(max-width: 659px) 100vw, 659px\" \/><\/p>\n<p><strong>Make sure you are using a text editor to edit and save the CSV file<\/strong>. Make sure not to use Excel, since the client ID number formatting may cause issues.<\/p>\n<p>You can download the CSV template <a href=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2024\/01\/csv-template.csv\">here<\/a>.<\/p>\n<p>To find your stream ID, go to Admin &#8211; Data collection and modification &#8211; Data streams. Then open the data stream you have created. The stream ID is located on the left side of the details header.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1377 alignnone\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Stream-ID.png\" alt=\"\" width=\"895\" height=\"165\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Stream-ID.png 895w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Stream-ID-300x55.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Stream-ID-768x142.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Stream-ID-788x145.png 788w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/p>\n<h2>Step Four: Upload the Salesforce dataset to Google Analytics 4<\/h2>\n<p><span style=\"font-weight: 400;\">Go back to Google Analytics 4 \u2013 Admin \u2013 Data Import, and click \u201cCreate Data Source\u201d.<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Choose the data source name (e.g. something like &#8220;CRM data&#8221;).<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Select <strong>User data by <\/strong><\/span><strong><span style=\"text-decoration: underline;\">Client<\/span> ID <\/strong><span style=\"font-weight: 400;\">for the data type.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Then you can upload the CSV file you prepared in the previous step.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1379 alignnone\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/GA4-import.png\" alt=\"GA4 import\" width=\"761\" height=\"876\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/GA4-import.png 761w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/GA4-import-261x300.png 261w\" sizes=\"(max-width: 761px) 100vw, 761px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Once you click Upload CSV, you will be asked to map the fields.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1380 alignnone\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Field-Mapping.png\" alt=\"\" width=\"908\" height=\"252\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Field-Mapping.png 908w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Field-Mapping-300x83.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Field-Mapping-768x213.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Field-Mapping-788x219.png 788w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Once you map the fields, click &#8220;Import&#8221;, and wait for the file to be imported.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Note: If you see an \u2018unknown\u2019 error while uploading, most likely you are logged into multiple Google accounts. In which case you can try again using incognito or a different browser where you can log in with one email address only.<\/span><\/p>\n<h2>Step Five: Find the Salesforce Data in Your Google Analytics 4 Reports<\/h2>\n<p><span style=\"font-weight: 400;\">Now go to one of your GA reports like Traffic acquisition, and add a custom dimension to the report by clicking Secondary Dimension \u2013 Custom Dimensions \u2013 Lead Status:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1371\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example.png\" alt=\"Salesforce Google Analytics integration result example\" width=\"2130\" height=\"944\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example.png 2130w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-300x133.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-1024x454.png 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-768x340.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-1536x681.png 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-2048x908.png 2048w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/Salesforce-Google-Analytics-integration-result-example-788x349.png 788w\" sizes=\"(max-width: 2130px) 100vw, 2130px\" \/><br \/>\nNote that the uploaded data needs to be processed before it will show up in reports. Once processing is complete, it may take up to 24 hours for the imported data to be applied to incoming hit data.<\/p>\n<p>The steps above explain sending Lead Status information to Google Analytics 4, but you can also send information about the Opportunity object too, you just need to map the Google Analytics Client ID to the Opportunity object, you can follow the steps in this <a href=\"https:\/\/gaconnector.com\/docs\/mapping-ga-connector-lead-fields-to-accounts-opportunities-and-contacts-in-salesforce\/\"><span style=\"font-weight: 400;\">article<\/span><\/a><span style=\"font-weight: 400;\"> on how to map the field to the Opportunity object.<\/span><\/p>\n<p><strong>Congratulations! Now you can see which campaigns, keywords, ads, pages, blog posts etc produce the most qualified leads.<\/strong><\/p>\n<h2>Next Steps<\/h2>\n<p><span style=\"font-weight: 400;\">Bringing in lead statuses is a great first step toward revenue-driven marketing.<\/span><\/p>\n<p>But there <span style=\"font-weight: 400;\">are tons of other data points you can<\/span> import to Google Analytics 4 from Salesforce.<\/p>\n<p><span style=\"font-weight: 400;\">These include revenue, profit, number of successfully closed won deals and more.<\/span><\/p>\n<p>Right now GA Data Import only lets you import custom dimensions.<\/p>\n<p>It doesn\u2019t let you bring in metrics (e.g. revenue), track goals, or do other stuff <span style=\"font-weight: 400;\">you may want to do<\/span>.<\/p>\n<p>To do this, you can use a tool\u00a0like\u00a0<u><a href=\"https:\/\/gaconnector.com\/salesforce-google-analytics\" target=\"_blank\" rel=\"noopener noreferrer\">GA Connector<\/a><\/u> which enables you to bring any kind of data from Salesforce into Google Analytics 4 automatically, without uploading any spreadsheets.<\/p>\n<div class=\"container-lazyload preview-lazyload container-youtube js-lazyload--not-loaded\"><a href=\"https:\/\/www.youtube.com\/watch?v=IpGjEUKUnNE\" class=\"lazy-load-youtube preview-lazyload preview-youtube\" data-video-title=\"Salesforce &amp; Google Analytics integration\" title=\"Play video &quot;Salesforce &amp; Google Analytics integration&quot;\">https:\/\/www.youtube.com\/watch?v=IpGjEUKUnNE<\/a><noscript>Video can&#8217;t be loaded because JavaScript is disabled: <a href=\"https:\/\/www.youtube.com\/watch?v=IpGjEUKUnNE\" title=\"Salesforce &amp; Google Analytics integration\">Salesforce &amp; Google Analytics integration (https:\/\/www.youtube.com\/watch?v=IpGjEUKUnNE)<\/a><\/noscript><\/div>\n<p><span style=\"font-weight: 400;\">With <a href=\"https:\/\/gaconnector.com\/salesforce-google-analytics\">GA Connector<\/a>\u00a0<\/span>you\u2019ll be able to build even more powerful Google Analytics reports with offline data:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-1381\" src=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report.png\" alt=\"ga4-report\" width=\"1875\" height=\"994\" srcset=\"https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report.png 1875w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report-300x159.png 300w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report-1024x543.png 1024w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report-768x407.png 768w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report-1536x814.png 1536w, https:\/\/gaconnector.com\/blog\/wp-content\/uploads\/2017\/05\/ga4-report-788x418.png 788w\" sizes=\"(max-width: 1875px) 100vw, 1875px\" \/><\/p>\n<p>Happy analyzing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This detailed step-by-step guide will show you how to integrate Salesforce.com with Google Analytics 4. What Will a Salesforce and Google Analytics 4 Integration Do For You? The goal of marketing is to drive revenue. But Google Analytics 4 is only good at measuring sales that happened right on the website\u00a0(e.g. an e-commerce store). But\u00a0most&#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":[31,330,333,325,73,20,16,329,323,39,328],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/212"}],"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=212"}],"version-history":[{"count":68,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":1388,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/posts\/212\/revisions\/1388"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/tags?post=212"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/gaconnector.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}