Integrate Google Analytics and Salesforce Data: 2 Easy Methods


Google Analytics and Salesforce Data

Are you trying to integrate Google Analytics and Salesforce data? Do you want to get insights into your Salesforce data to take better actions? If yes, then this blog will answer all your queries. In this blog, you will go through Google Analytics, Salesforce, and two different approaches to integrate Google Analytics and Salesforce data easily. When you integrate Google Analytics and Salesforce data, you get insights into the marketing data that can help you take actions to fetch better results. Salesforce is one of the most popular CRM tools that allows you to manage your relationships with your customers, leads, sales, opportunities, etc. Google Analytics also allows you to keep track of the conversion funnel conveniently. 

Table of Contents


To achieve Google Analytics and Salesforce integration, you need to have the following:

  1. A Google Analytics account with Edit permissions for Analytics property. 
  2. A Salesforce account with System Administrative settings and Modify all data permission. 

What is Google Analytics?

Google Analytics and Salesforce Integration: Google Analytics Logo
Image Source

Google Analytics is a web analytics service that tracks and reports website traffic. It allows in-depth analysis of the visitors on your website and then provides valuable insights. Google Analytics puts numerous lines of tracking code into the code of your site. This code is responsible for recording various activities of the users on your website. All the recorded information is sent to the Google Analytics server once the user exits from your website. Google Analytics uses encryption while sending this data so that no one can intercept the information that’s being collected. Google Analytics also supports integrations with various applications and helps you track and analyze your data conveniently. 

What is Salesforce?

Google Analytics and Salesforce Integration: Salesforce Logo
Image Source

Salesforce is a cloud-based Saas (Software-as-a-Service). It is CRM (Customer Relationship Management) software that offers complementary enterprise application services. It can act as a helping hand for your IT team, marketing team, commerce team, etc. It is comparatively faster than traditional CRMs. It also supports customization. As Salesforce is on the cloud, all the team members can access it from anywhere at any time. Some of the most popular services offered by Salesforce are sales, marketing, health, etc. All these are accessible to you at a reasonable price. Know more about Salesforce pricing here

2 Methods to Integrate Google Analytics and Salesforce Data

You can use any of the following methods to integrate Google Analytics and Salesforce data:

  • Method 1: Using Salesforce Sales Cloud Data Import
    This method uses Salesforce Sales Cloud Data Import to integrate your Google Analytics and Salesforce data. You will also encounter the limitations of using this method for the integration process.
  • Method 2: Using Hevo Data
    Hevo is a No-code Data Pipeline. It supports pre-built integrations from 100+ data sources including 30+ Free sources like Google Analytics and Salesforce. With Hevo, Google Analytics and Salesforce integration become a cakewalk.

Let’s discuss these methods in detail.

Why integrate Google Analytics and Salesforce?

The purpose of Google Analytics and Salesforce integration includes:

1) Find out which marketing channels generate high-quality leads

Some of your marketing campaigns may generate a large number of leads that rarely convert and thus waste the time of your sales team. While other channels may generate a small number of leads, a significant portion of these leads will become long-term customers who will spend a significant amount of money with your company.

It is measured using a metric known as “Revenue per lead“.

2) Google Analytics and Salesforce integration gives you a 360 view of your marketing campaigns

The goal of marketing is to generate a steady stream of lukewarm leads that will result in high revenue per lead. To do so, you must determine which specific marketing channels, campaigns, blog posts, keywords, etc are more likely to generate those leads.

This is where Google Analytics and Salesforce can help. It provides a 360-degree view of your marketing campaigns and allows you to calculate the ROI of each channel, campaign, and keyword. So you can focus more on marketing activities that are effective and less on those that are a waste of your time and money.

How do Google Analytics and Salesforce Compliment One Another?

Google Analytics provides a detailed view of how different user groups discover and interact with your website and mobile applications. While it is possible to use Google Analytics to analyze an individual user’s behavior, the tool was not designed for this purpose.

1) Salesforce Marketing Cloud & Google Analytics

The Salesforce Marketing Cloud includes tools for interacting with customers and creating personalized experiences for them, such as automated emails and product recommendations. This is accomplished by developing campaigns that target specific user groups.

When you integrate the Marketing Cloud with Google Analytics, you give Google Analytics access to campaign data. This is accomplished by simply adding UTM parameters to your Marketing Cloud campaign links and then pulling reports from the Google Analytics API to see how well those campaigns performed.

As previously stated, Google Analytics and the API used by Salesforce are designed for analyzing groups of users, which is exactly how Marketing Cloud reporting works. As a result, the two tools provide useful information for marketers who need to compare the relative performance of multiple campaigns.

2) Salesforce Sales Cloud & Google Analytics

The Salesforce Sales Cloud, on the other hand, serves a very different purpose than the Marketing Cloud. It provides tools for understanding individual customers, recording detailed information about them, and providing the necessary information to your sales team to drive meaningful interactions with them and, ultimately, close deals.

When you integrate the Sales Cloud with Google Analytics, you send individual users’ activity from the Sales Cloud to Google Analytics after they have been modified in the Sales Cloud. Because Google Analytics is not designed to pull information about individual users, it does not send any data to the Sales Cloud.

This integration is most commonly used by B2B sites where the goal of the website or mobile app is to drive potential customers to submit a lead form, and then the transaction takes place offline. When a user submits a lead form on the website or app, the Google Analytics ID (known as the “client ID” or “user pseudo ID” in GA4) is passed into Salesforce. When the sales team updates the Salesforce record to indicate that the deal has been won, Salesforce will send an event back to Google Analytics.

Marketers appreciate this integration because it allows them to compare the relative performance of their campaigns within Google Analytics and calculate the true cost per acquisition rather than simply a cost per lead.

Unfortunately, neither of these integrations is particularly beneficial to Sales teams.

The Google Analytics and Salesforce Integration for Sales Teams

Performance is measured differently by Marketing and Sales teams. The standard Google Analytics and Salesforce integrations are not as useful for Sales teams as they are for Marketing teams. Sales teams manage relationships with individual leads whereas Marketing teams are concerned with groups of people. Hence, they have different requirements.

Despite the fact that Google Analytics is a goldmine of individual behavioral data, the Sales Cloud integration does not import it into your lead records. This is unfortunate because the data stored in Google Analytics could benefit sales teams in a number of ways, including:

  • Drive meaningful conversations: Having quick and easy access to a customer’s website or app interaction history can reveal which products they are interested in or which issues they are researching with the support team.
  • Prioritize time: The history of website and app interactions can be used for lead scoring and to help the sales team understand who is most likely to go for a purchase call.
  • Respond to changes: Notifying the sales team when an old lead resurfaces on the website has the potential to rekindle stale relationships.

The good news is that Google and Salesforce have both recently launched new products that make data more accessible and transferable between systems. As a result, you can now access your Analytics data and import it into your Salesforce Sales Cloud lead, contact, and opportunity records.

Method 1: Using Salesforce Sales Cloud Data Import

Salesforce provides Salesforce Sales Cloud Data Import that lets you bring the sales pipeline data directly to Google Analytics for analysis. With Salesforce Sales Cloud Data Import, you can conveniently augment your digital analytics with offline sales data (for example, opportunities, leads, product data, etc.), which gives you a complete view of your conversion funnel.

Let’s see what are the steps to connect Google Analytics and Salesforce data:

Step 1: Identify your Users

Google Analytics supports two ways to programmatically identify your user, i.e., Client ID and User ID. Data Import implements using the Client ID. You can also implement it using the User ID.
Implementation using the USER ID requires additional set up as mentioned below:

  • Activate the User ID features in Google Analytics property.
  • Add this User ID to the lead form page and any other page that you want to track. Follow this guide here that can help you to do this via Google Tag Manager.

Step 2: Required Salesforce Sales Cloud Objects and Fields

To achieve this integration, you need to have full access to the following Salesforce objects and fields.

LeadStatusID, MasterLabel, SortOrder
OpportunityStageID, MasterLabel, SortOrder, IsActive
LeadHistoryCreatedDate, OldValue, NewValue, Field
OpportunityFieldHistoryCreatedDate, OldValue, NewValue, Field
OpportunityAmount, StageName, GACLIENTID*, GAUSERID*, GATRACKID*
OpportunityLineItemAll fields
Product2 (Products)All fields
Pricebook2 (Price Books)All fields

If you are using Salesforce Group Edition or Salesforce Professional Edition, then field access is granted by adding all the necessary fields to the Lead and Opportunity page layout.

Step 3: Create New Custom Fields

Using the instructions as stated here, you have to create three custom fields to store the Google Analytics tracking codes. Also, note that all the field names must be uppercase and must have read-only permission. Create these fields in both lead and opportunity.


To configure the Lead object, enable Field History Tracking for your lead status field and for configuring opportunity object, enable Field History Tracking for Stage fields. It is to make sure that any update to these fields generates a hit event.

Map the fields in each of the objects to their counterpart in another object:

Lead.GAUSERID to Opportunity.GAUSERID

Step 4: Edit your Lead Form

For this step, you need to know your Google Analytics tracking ID. The following code tells you how to add the custom tracking fields that you created above, to the lead:

<form action="" name="myForm">
   Phone: <input type="text" name="phone_number">
    <input type="hidden" id="GACLIENTID" name="GACLIENTID" value="">
    <input type="hidden" id="GAUSERID" name="GAUSERID" value="">
    <input type="hidden" id="GATRACKID" name="GATRACKID" value="UA-XXXXX-YY">
    <input type="submit">

This code adds Client ID and User ID to your form. You can also remove GACLIENTID if you are using a Client ID. You need to replace “UA-XXXXX-YY” with your Google Analytics tracking ID.
Note: You can also retrieve your tracking ID dynamically using this code:

<script type=”text/javascript”>
    	ga(function() {
      var tracker = ga.getAll()[0];
      var trackingId = tracker.get('trackingId');

Add the following code to your lead so that you can populate the Client ID and User ID values.

<script type="text/javascript">
    '	submit', function(event) {
     	 ga(function() {
     	   var tracker = ga.getAll()[0];
        var clientId = tracker.get('clientId');
        document.getElementById('GACLIENTID').value = clientId;
        var userId = tracker.get('userId');
        document.getElementById('GAUSERID').value = userId;

Step 5: Link Google Analytics and Salesforce Sales Cloud Account

You will be able to link Google Analytics and Salesforce data by creating a new Data Import dataset and then providing access to your Salesforce Sales Cloud account.

Follow these steps to create a Salesforce Sales Cloud Data Set:

  1. Sign in to your Google Analytics.
  2. At the bottom left, select Admin and click the property to which you want to link. Make sure that you have Edit permission for that property.
  3. Select Data Import.
  4. Click Create.
  5. In Data Set Type, under CRM Data, select Salesforce.
  6. Accept the terms and conditions.
  7. Under Data Set details, give a name to your data and click Continue.

You can click the current credentials to see a list of successful Salesforce credentials. To remove the unused credentials, you need to right-click X. If the credentials are currently in use, you need to disable it before you remove them. 

Follow these steps to authorize Salesforce Sales Cloud:

  1. In the Data Source detail panel, select Create new authorization under Salesforce credentials.
  2. Enter a credential name.
  3. Select Access
  4. In the pop-up, login to your Salesforce Sales Cloud account. 
  5. The new credentials name will appear in the Salesforce credentials drop-down menu. 

To import your data from different Salesforce accounts, you need to repeat the above steps to create multiple credential sets.

Tracking your field setup panel helps you map your configured Salesforce fields to corresponding Google Analytics tracking IDs. After configuring the tracking fields, click Continue.

Step 6: Configure Salesforce Milestone to Import

You will select the Salesforce lead and opportunity milestone to import it. You can also select how often to import them. All these milestones import as Google Analytics events. 

  1. In the Data Source details panel, under the Milestone Selection, select the milestone you want to import from the drop-down menu.
  2. Click Continue.

Step 7: Data Source Schedule

You can use the following option to set-up import frequency:

  1. Select Continue.
  2. Select Done.

Step 8: Test your Setup

In this step, you will test your configuration by importing some data from Salesforce and analysing it in a Google Analytics report.

To import the data from Salesforce, follow these steps:

  1. Sign in to your Google Analytics account.
  2. At the bottom left, select Admin and click the property to which you want to link. Make sure that you have Edit permission for that property.
  3. Select Data Import from property column.
  4. The Data Set List page appears.
  5. Locate the data set created in the last step.
  6. On the right side, select Manage upload. 
  7. In the Uploads for Salesforce Offline-Conversion page, select More > Fetch Now.

If your upload was successful, then Status column shows Completed else it shows Failed. To view your imported data in a report, follow these steps:

  1. Select BEHAVIOR > Events > Top Events report.
  2. Adjust the time window to include uploaded data.
  3. Apply a secondary dimension of the Event Label. 

To view imported attributes in your Google Analytics report, add the custom dimension that you have mapped in the configuration steps as secondary dimensions.

Limitations of Using Salesforce Sales Cloud Data Import

Some of the limitations of using the above-stated method for Google Analytics and Salesforce integration are listed below:

  1. All the empty fields are removed automatically from the Measurement Protocol hit at the time of your import. 
  2. The imported data doesn’t contain commas as Measurement Protocol event hits are imported as CSV files.
  3. Measurement Protocol event hits can not exceed 8192 bytes.
  4. The imported data use the currency that was set up in your Salesforce account.

Method 2: Using Hevo Data

Image Source

Hevo is a No-code Data Pipeline. You can automate the integration of Google Analytics into various CRMs such as Salesforce, Zendesk, etc. for free. Hevo supports pre-built integrations from 100+ data sources. Hevo also supports real-time data migration. Hevo provides a reliable, consistent, and secure solution to you at a reasonable price

Let’s look at the unbelievable features of Hevo:

  1. Fully Managed: Hevo requires no management and maintenance as Hevo is a fully automated platform.
  2. Data Transformation: It provides a simple interface to perfect, modify, and enrich the data you want to transfer. 
  3. Real-Time: Hevo offers real-time data migration. So, your data is always ready for analysis.
  4. Schema Management: Hevo can automatically detect the schema of the incoming data and maps it to the destination schema.
  5. Live Monitoring: Advanced monitoring gives you a one-stop view to watch all the activities that occur within pipelines.
  6. Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support call.

Simplify your Data Analysis with Hevo today! 



In this blog, you have learned about Google Analytics, Salesforce, and the steps to integrate Google Analytics and Salesforce data using two different approaches. You can use Salesforce Cloud Data Import to achieve this integration. But, if you are looking for a fully automated solution, then try Hevo.


Hevo Data is a No-code Data Pipeline. It supports pre-built integration from 100+ data sources including 40+ Free sources like Salesforce, Google Analytics, etc. You can send integrated data from your application to a data warehouse using two simple steps. 

SIGN UP and experience the feature-rich Hevo suite first hand.

Share your experience of integrating Google Analytics and Salesforce data in the comment section below. 

Oshi Varma
Freelance Technical Content Writer, Hevo Data

Driven by a problem-solving ethos and guided by analytical thinking, Oshi is a freelance writer who delves into the intricacies of data integration and analysis. He offers meticulously researched content essential for solving problems of businesses in the data industry.

Integrate and Analyze your Data in Data Warehouse