Dynamics 365 Portals include site settings for tracking logins and page view (though in a simple way only). However, these settings are now deprecated and we need to look to other methods.
From my research the method recommended by Microsoft is to use Azure Application Insights as described at Portal Deprecated Features.
Setting up Azure Application Insights is relatively easy. You will need to add code to the portal and this is done by adding the code to the Tracking Code content snippet.
Having done this, Application Insights will start to capture views and provide all sorts of interesting information.
But the one thing that is missing is seeing who viewed pages and so on. To do this we need to add another piece of code to the snippet as described at Azure Metrics.
Azure Application Insights only stores logs for 90 days. To store data for a period of your own choosing, use the Continuous Export feature.
The data in the Azure blob is in JSON format. The data might be more useful in Azure SQL, this article Export to SQL from Azure Application Insights describes how to export from the Azure blob to Azure SQL.