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.
Analyzing Salesforce data with Google Analytics: Part 1, Part 3, Part 4
Written by Arun Kumar Bharati, Salesforce Developer at Eternus Solutions
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:- Go to Setup | Customize | Home | Custom Links
- Click on the New button
- Label it as Google Analytics
- Change the Behavior to Execute JavaScript
- Change the Content Source to OnClick JavaScript
- 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")}
- 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:- Go to Setup | Customize | Home | Home Page Components
- Click on New button
- Click on Next button if the Overview page is loaded
- Name the new custom component as Google_Analytics
- Select Type as Links
- Click on Next button
- 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
- 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.- Go to Setup | Customize | Home | Home Page Layouts
- 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
- Check the Google Analytics checkbox under “Select Narrow Components to Show“section.
- Click on Next
- 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
- 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.- Go to Setup | Customize | User Interface
- Ensure the sidebar option Show Custom Sidebar Components on All Pages is checked
- You can check your custom sidebar components on all the pages. It should look similar to the screenshot shown below:
- 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.
- 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.
Analyzing Salesforce data with Google Analytics: Part 1, Part 3, Part 4
Written by Arun Kumar Bharati, Salesforce Developer at Eternus Solutions
No comments:
Post a Comment