To add Google Analytics to your Customer Portal you need the following:
Google Analytics Tracking ID
Get to know your customers visiting behavior. See the complete image of how your Portal interacts with users
Google Analytics
Select the Jira icon > Jira settings > Apps or Add ons.
Under Tinker for JSD, click Google Analytics for JSD
The first step to setting up tracking for your customer portals is to create an Analytics property. After obtaining the tracking ID, add it below to set it up on the portal.
An example Tracking ID: UA-00000-2
Custom Analytics using Javascript
Configure your custom analytics framework like Matomo and any other tool by pasting the Javascript that will inserted on portal head tag
Add you Javascript to text area and then click Save