getVisitorProfilePopup sometimes does not work

Sometimes when I call getVisitorProfilePopup it does not manage to show any data. For instance:
https://my-site.com/piwik/?date=today&module=Widgetize&action=iframe&visitorId=something&idSite=1&period=day&moduleToWidgetize=Live&actionToWidgetize=getVisitorProfilePopup&token_auth=hidden

I get the visitorId from Piwik’s Javascript methods getVisitorId() and most of the time it works, but in some cases it just says “There is no data for this report”. In reality, the user should have a record as they have visited some pages, but Piwik fails to show. Any hint?

For anyone else facing this issue, the solution is to add this to /config/config.ini:
[Tracker]
trust_visitors_cookies = 1

More details in the FAQ