Best practice to track campaign URL's on SPA sites?

I’m moving a bunch of SPA sites from GTM to MTM. To track pageviews I’m pushing pagePath and pageTitle to the datalayer and then capturing the values using data-layer variables, which I then use to create virtual pageviews in the pageview tag.

The thing is though, that the pagePath datalayer push doesn’t contain URL parameters, e.g. MTM parameters. And because of that I get all campaign traffic as direct, as the parameters aren’t sent to Matomo.

What’s the best way to solve this? In GTM I’ve used a third data-layer push; originalLocation containing the full URL, including hostname and parameters. This value has then been used to set the Location field in the Google analytics settings variable, to maintain the campaign URL parameter as source for the visit. Is there a similar way to do this in MTM?