Piwik not working on www

I have piwik installed on one server. I have a website (example.com) running on a different server.

When, I access the website http://example.com, the entries are getting logged in Piwik, but not when I access the website http://www.example.com. Please note that the www is on CDN and the CDN gets data from http://example.com via origin pull.

I guess it’s not a server issue, because when I access the website http://example.com (without www), the entries are getting logged.

PS: I posted a similar question here earlier, but didn’t get any reponse

I recommend you try and use FIREBUG and see what the website request to piwik is doing? or put here the URL that does not work? Tracking API - Analytics Platform - Matomo