- 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
‎02-14-2017 06:13 AM
Those statistics are in Google Analytics. Log into your account at http://analytics.google.com and you should see them there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 01:50 PM
hey Brian,
I am fairly new to service portal and trying to achieve the same GA functionality for our organization. My question is how can I add this custom widget to every page on the portal?
Regards,
Mohammed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 01:53 PM
Header and footer are widgets that are included on every page. OOTB widgets are not-editable, so you'll have to clone them. Then go to your theme, and change the header or footer to use your new custom one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2017 12:53 PM
To add a follow up, some additional steps I've taken inside of Google Analytics to improve the data reported there. You can manipulate the URL as Google sees it to adjust for the Angular single page application framework of Service Portal, and track search behaviors as well. If you haven't done this, check these steps out.
- Navigate to your Admin > Account > Property (website) > View.
- **** NOTE any changes you make to this view are immediate, and are NOT retroactive. I recommend creating a NEW view, and testing the changes out there
- **** Any unwanted or bad changes made to a live view will cause bad data to populate, that cannot be undone
- Navigate to Filters under your View
- I have created the following filters:
- Domain in URL - use this to filter out non-prod vs. prod instances for your views (so you don't track your dev environment traffic)
- You can use this to set up multiple views for your dev traffic (so you can test changes you make in your dev environment)
- Take the URL to lowercase. Service Portal uses a lot of URL parameters that can be set to mixed cases. Google Analytics, by default, sees a user searching for "Printer" differently from a user searching for "printer". "PRINTER" would also show up as a different search. Even though 3 people were searching for the phrase printer, you would see 3 different search terms. By taking it all to lowercase, you level the playing field where case doesn't matter.
- You have to make 3 filters to lowercase the entire URL. Filter 1 to Lowercase the Hostname, Filter 2 to Lowercase the Request URI, and Filter 3 to Lowercase the Search Terms.
- Break up Angular's single page application nature to appear as a normal website structure. If you notice your URL is pretty similar across all pages: myinstancename.service-now.com/portalname?id=page. The only thing that really changes is id=, or if you have other parameters, those change too. By that URL structure, Google Analytics sees that users are only on 1 page of your website: portalname, and they don't browse around. By manipulating the URL, we are 'tricking' GA into seeing it as a normal website.
- First, change ?id= to a /, so myinstancename.service-now.com/portalname?id=page becomes myinstancename.service-now.com/portalname/page
- This is done with a simple Find & Replace
- Then, change your first & to a ? (in case you have other URL query strings, you don't lose them). This changes myinstancename.service-now.com/portalname?id=page&sys_id=1234 to myinstancename.service-now.com/portalname/page?sys_id=1234
- Again, a simple Find & Replace will do. It only does it for the first one
- First, change ?id= to a /, so myinstancename.service-now.com/portalname?id=page becomes myinstancename.service-now.com/portalname/page
- Domain in URL - use this to filter out non-prod vs. prod instances for your views (so you don't track your dev environment traffic)
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
Now give it a couple of days to generate traffic, and go look at the cool analysis of your website traffic. You can see your user's path under Behavior > Behavior Flow, and your search activity under Behavior > Site Search. Enjoy!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 06:46 AM