How can I get live counters for specific page?

I want to get live visitors only for one specific page. I’m using Live.getCounters and specify segments like this:

https://example.com/index.php?module=API&format=JSON&token_auth=MY_TOKEN&idSite=MY_SITE_ID&lastMinutes=5&method=Live.getCounters&segment=pageUrl=$example-path

*Using =$ operator to get page which ends with example-path

I can get visitors for the page, but the issue is that if that user navigates to another page on the same website, I will still get him as a live visitor for the specified page (but he is already on another one). I also tried to use eventUrl and actionUrl instead of pageUrl but got the same results.

I also tried to use Actions.getPageUrl but it returns the visitors count for the whole day. I need only recent online users (ex., users who visited the page during the last 5 minutes)

I will appreciate any help. I could not find the strict answer in the documentation and the forum.

Hi @Elcin_Hasanov
Indeed, a segment is not a filter, this is made to select visit. Then select any visit in which the user visited some pages which name is terminated by example-path
1 suggestions (no tested): Use the Exit Page URL (seems to be exitPageUrl) instead of pageUrl.