Mutiple Visitor IDs in same session

I’ve got a clean version of piwik running and I’ve noticed that, as expected the first time I hit a page which calls the tracking code, I can see my visit registered in the visitor log.

If my page then sends an event, then whilst I see the event registered, I also notice that a new visitor profile ID is issued.

Is it possible therefore that this will be registered as two visits?

Could you elaborate? How your website sends an event? What do you mean by profile ID?

If Piwik does not match an active visit via idvisitor (from cookie), there’s a fallback to config_id (browser fingerprint).

We’ve got 1-to-many web servers behind an AWS Elastic Load Balancer which solely collects data. There’s a separate standalone instance upon which we run the UI and which also runs the archiving cron

Because requests are all served through the ELB and it’s highly likely that a user’s action will seldom be recorded by the same web server behind the load balancer, I know that might cause session issues so I’ve enabled:

proxy_client_headers[] = HTTP_X_FORWARDED_FOR
session_save_handler = dbtable

trust_visitors_cookies = 1

The server fleet is handling 1.9m event data points per day.

This one is not recommended. You should enable this setting only if you track an intranet site (many devices/workstations with same IP and configuration - browser fingerprint). See this one: How to - Analytics Platform - Matomo

Currently, it’s possible to create many visits if cookies support is disabled in the browser.

Do you experience any other issues?

Should I set that to zero or remove the entry altogether? If I do, will Piwik behave properly given that there is no guarantee that the piwik web server which first serves a user, will be the one that serves subsequent piwik requests? Such is the challenge of a load-balanced environment

Everything will work fine. Load balancer is forwarding all important information. Just remove these lines or set it to 0. Both will work.