Identify visits with more than one page view?

How do i identify visits with more than one page view? I will create a JavaScript if rule for this like:

if (page_views > 1) {
// my code.

Hi @melbao

Sorry, I don’t understand at which step you want to achieve this? During tracking? In Matomo reports?..

Hi Philippe, more as general. In the moment i test this:

if (document.referrer.includes(window.location.hostname) === true) {
 // my code.

But, yes, i have not thought about it enough. After all, no data is sent from the Matomo installation to the webpage with the tracking code. Possible would be to send info by query string, but I don’t like that.

Hi @melbao
It seems you want to identify the visit length during tracking
Maybe you could use a session-time-duration cookie (eg. visitedPage=1 when cookie is not set and visitedPage=visitedPage+1 when cookie is set)
Then when doing the track, you just have to store the value that is in the cookie, as a visit-dimension…
As the last value of such a dimension is kept by Matomo, you’ll ever be able to know visits length… (and create some segments on this dimension)

By me, it don’t work with cookies, because this is in use


also cookies don’t needed.

It works fine with the document.referrer detection. The tracking is started in the first page visit after 3 seconds and in further page visits at 0 seconds. The whole code is a little bit complex and large, with multiple setInterval and setTimeout and more.