Unique visitors using custom variable


I have a requirement to track the unique number of visitors to a web page, from what I understand, piwik does the unique tracking by the IP address/OS and visitors using first party cookies.

But for my application, if two different people are using the same computer (ip), they should be treated as seperate visitors. For this I am using JSESSION_ID and planning to use a custom variable to achieve the same.
a) Is this the correct approach ?
b) While using custom variable, under the Visitors -> Custom variable, though i am able to see the list of unique visitors, the total count for same is not reflected against the unique visitors reported?
Is there any custom setting required at my end ? Please help

All am doing in my code is to check the SESSION ID for null, if not null am setting it to a custom variable value
Below is the code for same
var myVar = “<s:property value=’%{sessionID}’/>”;
if(myVar==null || myVar==undefined || myVar==’’){
piwikTracker.setCustomVariable(1, ‘UniquevisitorHBE’,myVar,‘visit’);

Doable this way for sure. We also plan to add a setVisitorId() to the Javascript API so that you can force the visitor Id: Accurate User Detection cross devices: User ID (set in JS and all other clients) · Issue #3490 · matomo-org/matomo · GitHub

please comment on this ticket if you’re interested!

Hi Matt,

From my point b) in the above post, I am not able to see the count of unique visitors using the code snippet attached. what I understand from your reply is do we need to do a setVisitorID() to reflect those counts ??
Can you please guide me how to achieve the same or what did you mean doable??