- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 06:26 AM
Has anyone put Google Analytics on the Service Portal? I put it as a javascript include at the theme level. This seems to work, but only for the initial page the user hits or any refreshes. Since navigating around the portal typically doesn't involve reloading a new page, it would seem GA doesn't get the hit that the URL has changed.
I tried putting the tracking code into a widget in the header on all pages, but that didn't seem to work any better.
Any ideas? Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2016 12:09 PM
Did you create a UI script, or did you go through Service Portal > Themes > your theme > JS Includes? This is where the script will need to be. <edit: I re-read your post and saw you did that>
Also, remove the <script> tags (lines 1 & 10) from your script include. The yellow dot errors can be ignored.
That implementation should work great. I did end up combining that JS Include into the header widget as well for simplicity's sake. Here is a screenshot.
(if you choose to do it this way, you'll have to edit it in the Service Portal Configuration > Widget Editor. Editing it directly from Widgets will not let you save as the script editor barks at that red dot error, but that is code directly from Google so I left it alone)
And is working very well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 12:15 PM
That certainly is an issue. If you went the UI script route, make sure it is not set to Global. That would put the tracking code on every page in ServiceNow. See my reply in this thread dated Dec 5, 2016 12:22 PM. That sounds like the issue here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 12:24 PM
So as long as I uncheck Global on there, I should be good to go?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 12:51 PM
Yes. You can see the impact instantly if you go to the Real Time report in Google Analytics. You should see internal ServiceNow traffic fall off after changing that checkbox.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 01:58 PM
Looks good now, thanks Brian!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 03:36 PM
Hi Brian,
Question for you on the above - I am looking at using this for my HR Portal website and keen to understand if i have it setup correctly:
That will clean up your URL. The last thing you should do, is set your homepage name, and define search and filtering URL criteria. What this does is help GA condense /portalname and /portalame/index into the same page view (as they are), AND, by defining search URL criteria, you can use GA's advanced Site Search analytics.
These are both under View Settings. In "Default page" put index (unless you changed it). Enable Site search Tracking, and enter the letter q for the Query parameter
The URL for my portal is: https://instancename.service-now.com/hrportal_dev
However instead of 'index' (which the Service Portal uses) my secondary link is: https://instancename.service-now.com/hrportal_dev?id=hr_dashboard_cjf
What do I enter into the default page? - I entered the below but do I need anything else here?
Second question - regarding the 'Site Search Settings' - from your text i assume all we need to enter is the letter 'q' as below:
Thanks for your help with this.