Can't get custom variables for page to work


I have a goal to count page views per user. So in the end I would like to have something like this:

page1 views: 30 (uinique 3)
user1 9
user2 15
user3 6

As I understood, custom variable should do the thing for me. If I’ll use ‘page’ context I’ll be able to count all page views, even the number of views per unique visitor, right? So, i’ve add a JS code on my page:

var piwikTracker = Piwik.getTracker(pkBaseURL + “piwik.php”, 3);
piwikTracker.setCustomVariable(1, “page1 views”, “{{ username }}”, “page”);

With each request I got a new record in the _log_link_visit_action table with my custom variable data, but strange results are showing in the piwik UI. Please refer to attachment file for the details.

It has all numbers I need I could even try to understand this table, but the customer will never do.

Moreover I need to track one/two more similar variables for this view in parallel.

What could be the best solution for such scenario?

Thanx for your answers.

Update: numbers are fine, but values are mixed up: visits vs. unique visitors. It is a bit unclear why the visits number is less than unique visitors. I would rather have it other way around.

See faq: General - Analytics Platform - Matomo