Google Analytics to Salesforce: 2 Easy Methods

• September 15th, 2020

google analytics to salesforce

Are you looking for a simple way to move your data from Google Analytics to Salesforce? You have landed on the right page. This guide takes you through all the steps involved in moving data from Google Analytics to Salesforce.

Here’s a snapshot of what you will be looking at:

Introduction to Google Analytics

Google Analytics is a cloud-based product offered by Google. It is an open-source analytical tool that analyzes and reports website traffic and customer behaviour. 

The Google Analytics dashboard has a comprehensive list of features and can integrate with a different platform with ease. It is a trendy choice for industries due to its reporting capabilities that drive their business decisions on customer’s behaviour and interaction.

Features of Google Analytics

  1. Google Analytics automatically collects all the information from the website, like traffic, region, users, clicks, etc. and generates extensive analytical reports.
  2. Google Analytics dashboard allows you to understand customer behaviours, their interaction on your products, the reasons for bouncing off, source platform, lead generation and many more.
  3. Analytics dashboard can help you study the competition and drive the strategic decisions based on the customer segment and engagement.

Introduction to Salesforce

Salesforce is a Customer Relationship Management platform mainly used to maintain and manage customer interaction. It is available as Platform-as-a-Service over the cloud. You can leverage CRM applications for sales, marketing, service, community, analytics provided by Salesforce to your advantage. 

Features of Salesforce

  1. Contact Management: Salesforce manages contact very efficiently. It provides critical insights on the customer data to understand the patterns and behaviours.
  2. Dynamic Dashboards:  With the dynamic dashboards, Salesforce displays the market trends, customer sales to get real-time reports for your business.
  3. Opportunity Management: Salesforce provides an excellent view of customers buying pattern, purchasing history, and many more. The dashboard can help the organization to strategize their decisions. 
  4. Email Integrations:  Salesforce also allows you to set up mail servers like Microsoft Outlook, Gmail, etc. to synchronize your calendars. 

Ways to Connect Google Analytics to Salesforce

Method 1: Manually Connecting Google Analytics to Salesforce

Using custom code snippets to connect Google Analytics to Salesforce is one such way. This method requires users to create custom fields & objects in Salesforce and then configure them to enable tracking. You’ll then need to add javascript-based code snippets containing the Google Analytics tracking tags to help you monitor data. You can then authorize the connection and start importing data from Google Analytics to Salesforce based on your custom mapping.

Method 2: Using Hevo Activate, A convenient way to connect Google Analytics to Salesforce

Hevo Activate provides a hassle-free solution and helps you directly transfer data from Google Analytics to Salesforce for free without any intervention in an effortless manner. Hevo Activate is fully managed and completely automates the process of not only loading data from your desired source but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Hevo’s pre-built integration with Google Analytics (among 30+ Free Sources) will take full charge of the data transfer process, allowing you to focus on key business activities.


Methods to Connect Google Analytics to Salesforce

Salesforce is a leading CRM tool to manage customer relationships. When it is connected with a web tracking system such as Google Analytics, it is capable of providing the full A-Z journey of the user (i.e. from the web to sales).

Method 1: Manually Connecting Google Analytics to Salesforce

Below is the step by step guide on how you can move the data from Google Analytics to Salesforce:

1. Decide the Identification of User

There are two ways by which you can identify the users – Client ID and User ID. Salesforce integration of Google Analytics requires Client ID. ClientID is a non-authenticated, cookie-based unique identifier created by Analytics when the user first visits the site. ClientID helps you to track the A-Z movement of the user, i.e. from surfing the web to sales.

2. Salesforce Cloud Objects and Fields

You need to have full access to the Salesforce objects and field to set up Google Analytics Salesforce Sales cloud integration. Generally, a Salesforce account with System Administrator may have full access to below objects and fields – 

Lead StatusID, MasterLabel, SortOrder
Opportunity StageID, MasterLabel, SortOrder, IsActive
Lead HistoryCreatedDate, OldValue, NewValue, Field
Opportunity Field HistoryCreatedDate, OldValue, NewValue, Field
OpportunityAmount, StageName, GACLIENTID*, GAUSERID*, GATRACKID*
Opportunity Line itemAll fields
Product2All fields
Pricebook2All fields

* Marked fields are custom fields that will be created manually.

3. Create Custom Fields

In Salesforce, you need to create custom fields to migrate the data from Google Analytics. Below are the field names that are generally required:

Field NameAPI NameField Length

In salesforce, you need to create all three fields as mentioned above. The field name should be uppercase and must be present in Lead and Opportunity objects.

For details on how to create a custom field in Salesforce, follow the guide here.

4. Configure Lead and Opportunity Objects

Now that you have created custom fields in Salesforce, you need to make the Lead and the Opportunity objects. You need to enable Field History tracking for Lead Object and the Opportunity object; you need to enable Field History Tracking for the Stage field. This action will ensure that any update to these fields will generate a hit event.

Map the fields as shown below:

  1. Lead.GACLIENTID to Opportunity.GACLIENTID
  2. Lead.GAUSERID to Opportunity.GAUSERID
  3. Lead.GATRACKID to Opportunity.GATRACKID

5. Edit the Form

Now that you have created the objects, you need to modify the lead form to capture the tracking information. 

Add Custom Tracking Fields:

Copy the below javascript to create the custom fields to your Lead form. If you have already created step 3, then you don’t need to perform this operation.

<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">

Set Custom Tracking Field Values:

Below code will help you to populate ClientId and UserId value – 

<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; 

6. Connect Google Analytics to Salesforce Cloud

Create Salesforce Data Set:

  1. Sign in to Google Analytics and navigate to the Admin page for the property that you want to link. You need to edit permission to do so.
  2. In the property column, click Data Import and then click create.
  3. Under CRM data, select Salesforce as a data typeset.
  4. Accept all the terms and conditions.
  5. Enter the name of the data and then click continue.

Authorize Salesforce Cloud:

  1. Create new authorization for the salesforce in the data source panel.
  2. Provide the credentials and click access
  3. Once you click on, a log in pop-up will appear. Provide the details to successfully log in.

Configure Salesforce Milestone Import:

  1. To configure the milestone import, under the milestone section, select the milestone from the drop-down to import.
  2. Click Continue.

Import Attributes:

  1. Select the attributes to import.
  2. Use the drop-down to map the Analytics fields to your Salesforce fields.​

Below is the example for the Analytics field to Salesforce mapping – 

Analytics custom field: scopeSalesforce field name
Dimension: session OR userLead: Lead ID
Dimension: session OR userLead: Lead Score (Salesforce Einstein predicted score)
Dimension: userLead: Industry
Dimension: session OR userLead: Rating
Dimension: session OR userOpportunity: Opportunity ID
Metric: hitOpportunity: Amount
Dimension: session OR userOpportunity: Probability (%)
Metric: hitOpportunity: Expected Amount
Dimension: session OR userOpportunity: Order Number

Import the Data:

  1. To import the data, click Enable Product data import option.
  2. Review the field mapping
  3. Select the data source schedule
  4. Then click continue, and then Done.

View Imported Data:

To view imported data, use the Conversions > Ecommerce > Sales Performance or Conversions > Ecommerce > Product Performance reports. Check the time frame for the imported data. Select the proper time frame for which you want to view the data.

Method 2: Using Hevo Activate, A convenient way to connect Google Analytics to Salesforce

Hevo Logo

Hevo Activate helps you directly transfer data from Google Analytics (a Free Source) and various other sources to CRMs such as Salesforce, various SaaS applications, data warehouse and a lot more, in a completely hassle-free & automated manner for free. Hevo Activate is fully managed and completely automates the process of not only loading data from your desired source but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Its fault-tolerant architecture ensures that the data is handled in a secure, consistent manner with zero data loss.

Hevo Activate takes care of all your data preprocessing needs and lets you focus on key business activities and draw a much powerful insight on how to generate more leads, retain customers and take your business to new heights of profitability. It provides a consistent & reliable solution to manage data in real-time and always have analysis-ready data in your desired destination. 

Check out what makes Hevo Activate amazing:

  • Real-Time Data Transfer: Hevo Activate with its strong integration with 100+ sources, allows you to transfer data quickly & efficiently. This ensures efficient utilization of bandwidth on both ends.
  • Data Transformation: It provides a simple interface to perfect, modify, and enrich the data you want to transfer. 
  • Secure: Hevo Activate has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Tremendous Connector Availability: Hevo Activate houses a large variety of connectors and lets you bring in data from numerous marketing & SaaS applications, databases, etc. such as Airflow, Hubspot, Marketo, MongoDB, Oracle, Salesforce, Redshift, etc. in an integrated and analysis-ready form.
  • Simplicity: Using Hevo Activate is easy and intuitive, ensuring that your data is exported in just a few clicks. 
  • Completely Managed Platform: Hevo Activate is fully managed. You need not invest time and effort to maintain or monitor the infrastructure involved in executing codes.
  • Live Support: The Hevo Activate team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.

Simplify your Data Analysis with Hevo Activate today!



In this blog post you have not only seen the salient features of Google Analytics and Salesforce but also how to connect the two. However, the manual method is lengthy and involves a number of steps.


Instead, you can use a fully automated, easy-to-use alternative– Hevo Activate. It helps you directly transfer data from a source of your choice such as a data warehouse like Redshift, Snowflake, etc. to any SaaS application, CRMs, etc. in a fully automated and secure manner without having to write the code repeatedly.

Hevo Activate with its strong integration with 100+ sources including 30+ Free Sources like Google Analytics, Salesforce, etc. & BI tools, allows you to not only export & load data but also transform & enrich your data & make it analysis-ready in a jiffy.

SIGN UP and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

Have any further queries? Get in touch with us in the comments section below.

Sync Your Data to Salesforce Seamlessly