getVisitorProfilePopup sometimes does not work

Sometimes when I call getVisitorProfilePopup it does not manage to show any data. For instance:

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:
trust_visitors_cookies = 1

More details in the FAQ