Google Analytics in Service Portal

google-analytics-in-serviceportal-servicenow

Google Analytics is a free web analytics service offered by Google that is used to track website activity and usage metrics. Google Analytics provides insights and data that can be used to create a better user experience for your employees coming to the Service Portal. There are many web analytics tools out there, including the new User Experience Analytics module from ServiceNow, but in this post, I will focus on Google Analytics.

Features include:

  • Traffic reporting
  • Checks behavior flow
  • Track conversion rates
  • Reports website speed
  • Traces sources of traffic

There is an OOB “Site Analytics” widget included in Service Portal, however, I do not believe this widget is working in current releases of ServiceNow. Because of this, I’ve created my own version of the Site Analytics widget and I am providing it here free of charge.

 

Click above to download the update set. Once you’ve committed the update set, you’ll need to embed the widget in your header or footer.

Remember to replace the tracking id with yours.

Chrome Plugins

When setting up Google Analytics in Service Portal, it’s also very helpful to install some additional Chrome Plugins. The two plugins I recommend are:

  • Page Analytics
    Official plugin by Google. Provides overlays on the portal with stats of views and clicks
  • Google Analytics Debugger
    Provides debugging information in the console to see what information is being sent

SEO Information

One of the initial challenges when setting up Google Analytics with Service Portal is that many pages, such as the sc_cat_item page, do not use unique page titles or ways of distinguishing one catalog item from another. This can be solved by adding SEO information to the Service Portal pages. This primarily consists of adding dynamic meta tags and titles to the page record.

This will make it easier for you to decipher which catalog items or knowledge articles are being viewed the most in Google Analytics.

Dynamic Meta Tags
Above you can see a dynamic “description” meta tag is mapped to the “name” of the catalog item, based on the sys_id in the URL.

Notes:

  • This is using the original “Universal Analytics”, not the latest “Google Analytics 4”, which we may cover in an upcoming post.
  • Employee Service Center has its own integration with Google Analytics.

Further Reading

Hopefully, this has been helpful. If you would like to dive a little bit deeper, you can check out the following resources:

3 comments

  1. I have used this code in my personal instance as testing with Google analytics, but no data comes to Google Analytics.
    I have committed your code, added widget into the header widget of the Service Portal and update the trackingid, but it’s working
    Can you have help me in this ?

    1. Did you download the debugging Chrome plugins? This will show you exactly what’s being sent and if there are any errors.

Leave a Reply

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