salesforce data migration services

Tracking Dynamic Pages Using Google Analytics In Salesforce

In this blog –  ‘ Tracking Dynamic Pages  Using Google Analytics In Salesforce ‘, I am going to demonstrate how you can :

  1. Set up Google Analytics for dynamic tracking
  2. Adding tracking code to the dynamic page.
  3. Displaying report using Google Analytics

Pre-Requisites: Using Google Analytics In Salesforce

Develop a dynamic Visualforce page that displays a record detail page based on the Id passed in the query parameter. You can refer to the example mentioned in this link on How to use Query parameters in a Visualforce page. You can also build a page to display knowledge articles similar to the example and use parameters in the Visualforce page from here. In our case, we are going to refer to Article Id as the query parameter. Please refer to this article to fetch the article details based on the Id passed.

Before we start setting up Google Analytics, you should know what does Google Analytics does. Google Analytics is one of the most popular digital analytics software. It is Google’s free web analytics service that allows you to analyze in-depth detail about the visitors on your website. It provides valuable insights that can help you to shape the success strategy of your business. For more details, please visit here – 10 good reasons why you should use google analytics.

  • Go to google.com and make sure you are logged in with the Gmail id you want to set up google analytics.
  • Go to analytics.google.com and log in using Gmail id.
  • Click on the lower left ‘Gear’ icon in the bottom left corner. After that click on Create Account as instructed in below image.

  • Once you create an account, the wizard will ask the below details :
    • Website details on that you are going to enable.
    • Site Search tracking if you want to enable the tracking on the dynamic page like (Query parameter) add multiple parameters separated by a comma. 

  • Once you enter all the details ,hit on the Save button. Once you hit the save button, It will give you the tracking code. If you don’t find the tracking code then click on the property section and check the tracking code by following the below screenshot  :

 

  • Copy this script generated by google analytics and add the code into the Header Section of Visualforce page that you want to enable tracking on-site.
  • It will start tracking within 24 hr. Once it starts tracking you can check reports in google analytics. 
  • Now toggle back to Google Analytics, Click on the Behaviour section on the left side and select the filter. It will display the record in table format. You can save the report. The saved report you will find in the Customization section on the left side.

 

  • If you have a query parameter in your page URL then you have to click on Secondary dimension and search for Search Term.

 

  • The above screenshot displays a complete detail of each search query parameter.
  • After you add all the filters you can save the report by clicking on save.

  • Once you click on the report  you can find the detailed report below :

 

I hope you understand now how you can Track Dynamic Pages in Salesforce Using Google Analytics. Check out other blogs on site here.

References :