The CreatorCon Call for Content is officially open! Get started here.

Google Analytics on Helsinki Service Portal

brian_
Tera Guru

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

1 ACCEPTED SOLUTION

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.



find_real_file.png


(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.



find_real_file.png


View solution in original post

38 REPLIES 38

Ripu Daman1
Tera Expert

Hi Brian,

 

I have configured GA on Service Portal but the search terms don't seem to get captured. All other metrics seem to be getting captured correctly. Can you please suggest some direction where i should be looking.

This is how the search setting looks in GA:

find_real_file.png

 

below is how Search query gets captured:

 

find_real_file.png

Just in case if anyone else is facing the same issue, adding the below mentioned filter helped capture search terms as well:

 

It is a filter to replace ?q with /?q. Now all the search terms are being captured correctly in GA. Hope it helps.

 

Hi, This does not seem to work.. I get an error saying regular expression invalid

 

find_real_file.png

 

Hi Prabhjot,

 

you will need to provide '\' character to make your search string be acceptable. For example, search string could be '\?id=' and the replace string could be '/'. Let me know if you face any issues.