As you find, Google Analytics will not provide page timings for SPA. This includes if you increase the site's sample rate to 100. This is because Google Analytics calculates page timings using the navigation synchronization API.
For example, the DOM is loaded:
$(document).ready(console.log((Date.now() - performance.timing.domComplete)/1000))
To deal with this problem, you will need to use special indicators. The solution consists of three steps.
1) Set up your own metric in GA.
Go to Admin> Property> User Definitions> User Metric.
Create a new custom metric with Hit scope and format time type. Note: specify the time in seconds, but it displays as hh: mm: ss in your reports.
2) Set the timer.
You will need to record the time when you want to start measuring the page load time.
An example of such a solution would be to decorate all your internal links, for example:
$('a[href*="stackoverflow"]').click(function(){ time1 = Date.now() })
3) Send the time, eclipse (in seconds) to Google Analytics, to the event of viewing a virtual page.
When a virtual pageview event (which triggers your virtual pageviews) occurs, extract the difference between the current time (Date.now ()) and the timer start time (time 1).
Using Google Tag Manager, a custom javascript variable can be created as shown below:
function(){ return (Date.now() - time1)/1000 }
Then this value must be sent with a page view, in accordance with the custom metric index set in step 1.
ga('send', 'pageview', { 'metricX': pageLoadSpeed });
Using a custom metric along with calculated metrics (for example, {{virtualPageTimings}} / {{pageViews}}, you can calculate the average values ββof a virtual page.
Bonus:
To make the measurement more accurate, set up a secondary custom metric to count the number of virtual page views. This will make sure that pageviews that users go directly to are not taken into account.
To do this, create your own metric with deleting the scope and integer formatting.
Then, with each virtual pageview, send a value of 1 to the custom metric index. For instance:
ga('send', 'pageview', { 'metricX': pageLoadSpeed, 'metricX': 1 });
This allows you to calculate the metric:
{{virtualPageTimings}}/{{virtualPageViews}}