Good practices to use Piwik with Spring MVC

Hi,

Are there some recommendations to use Piwik with an application using Spring ? especially Spring web flow, the same URL is used for several pages. What is the good pratice for that ?

Sincerly,

BG

Hi,

I don’t know anything about Spring, but Matomo tracking works always quite the same no matter which website you are tracking.
I am also not sure what you mean by this:

Isn’t the sole purpose of URLs to uniquely identify resources?

Nevertheless you can always use

        _paq.push(['setCustomUrl', theRelativeURL]);

before _paq.push(['trackPageView']); to dynamically overwrite the URL you send to Matomo in Javascript.

If the website is SPA-like (so multiple pageviews without reloading the page) you can always call _paq.push(['trackPageView']); again when Matomo should track another page. (See also https://developer.matomo.org/guides/spa-tracking)

Hi Lukas,

Thanks for your answer and i agree that i can use what you propose.

Maybe are there some Piwik and Spring users that can share their experiences.

Anyway, thanks again.

BG

1 Like

There is also the Java SDK, but I don’t know how good it is or if it works well with the current Matomo version.