July 14, 2015

Analyzing Salesforce data with Google Analytics: Part 2

In our quest of tracking the most popular Accounts based on page views, we had configured our Google Analytics account in the previous post. In this post, I will take you through the configurations required in your Salesforce org.

Creation of Home Page Custom Link

The first step in configuration of your Salesforce org is the creation of a Home Page Custom Link that will load our Google Analytics resource for tracking every page. This is a simple 7-step process:
  1. Go to Setup | Customize | Home | Custom Links
  2. Click on the New button
  3. Label it as Google Analytics
  4. Change the Behavior to Execute JavaScript
  5. Change the Content Source to OnClick JavaScript
  6. Copy the relative path URL of the JavaScript file that we added in the static resource

    We need to use {!REQUIRESCRIPT()} function, as using this function will load the script automatically upon page load, without even  needing to click on the Custom Link. The final URL will look somewhat like:
    {!REQUIRESCRIPT(“/resource/1428508522000/GoogleAnalytics”)}

    1

  7. Click on Save

Creation of the Home Page Component

Once you have created the Home Page Custom Link, you will need to create a Home Page Component in your Salesforce org, through a simple 8-step process listed below:

  1. Go to Setup | Customize | Home | Home Page Components
  2. Click on New button
  3. Click on Next button if the Overview page is loaded
  4. Name the new custom component as Google_Analytics
  5. Select Type as Links

    2

  6. Click on Next button
  7. Choose your Google_Analytics custom link from the left section list of options and move it to the right under the Custom Links to show tab in this new home page component, as shown below

    3
  8. Click on Save

Add Home Page Component to the Home Page Layout

As the next step, you need to add this home page component to a Home Page Layout and assign it to the users that you need to track.
  1. Go to Setup | Customize | Home | Home Page Layouts
  2. Click on Edit on the action column (see the screenshot below) next to the layout in which you want to add the Google Analytics tracking

    4

  3. Check the Google Analytics checkbox under “Select Narrow Components to Show“section.

    5
  4. Click on Next
  5. You will be redirected to the Order the components step, where you need to add your home page component into the Narrow(Left) Column section

    6
  6. Click on Save

Show Custom Sidebar Components on All Pages

As the final step of configuring your Salesforce org, you need to show your Custom Sidebar Component on all the pages, through a simple 3-step process listed below.
  1. Go to Setup | Customize | User Interface
  2. Ensure the sidebar option Show Custom Sidebar Components on All Pages is checked

    7

  3. You can check your custom sidebar components on all the pages. It should look similar to the screenshot shown below:

    8

Good News..!!! We are almost done…!!! Let’s see what we have got.
  1. Click on any tab of your Salesforce site and check under the Real time section of Google Analytics by clicking on the overview link.  Google will show the tab or page you clicked most recently. You can also see the Active page URL on the “Top Active Pages” section.

    9

  2. You can also see the all site content like numbers of visits, unique page views, bounce rate, page title, and average time on page etc. on the Behavior section of Google Analytics.

    10

In my next step, I will show how Google Analytics can be used for tracking your most popular Accounts based on page views, so that the key insights help your Sales reps take strategic action. Till then, stay tuned.


Analyzing Salesforce data with Google Analytics:  Part 1, Part 3, Part 4



Written by Arun Kumar Bharati,  Salesforce Developer at Eternus Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × 2 =

Share This Blog

Blog Archives

Subscribe to our Newsletter