Make PiwikPro java script code smaller?

I am a new PiwikPro Core plan user. I have installed the Piwik java script code on my WordPress websites with the PiwikPro WordPress plugin.

I noticed that the java script code installed by PiwkPro is a lot bigger than the code used by Google Analytics. The Piwik code is around 86KB and the GA code is just around 20KB. Uncompressed the Piwik code is more than 300KB.

Is there any way to make the code smaller in size? For example by disabling options in the Data collection settings?

Thanks for the help!

Best Wishes,

Hello @optipiwik, which .js file did you look at when analyzing size?
By default our container code is also responsible for loading Consent Manager and Tag Manager. That’s the file that contains the ID of your site or app from Piwik PRO (example: “74bda40d-ed9d-40c8-ac93-99d58da82a95.js”).

If considering just the main Analytics library (our JavaScript Tracking Client called ppms.js or ppas.js) loaded standalone or inside of the Tag Manager, the code is indeed a bit bigger than GA’s analytics library, but that doesn’t affect website’s overall performance. You can verify that by running tools like Lighthouse.

However, we understand that optimizing sizes of assets like JS libraries is important. Because of that, we are planning to reduce the size of our Analytics library in the near future. I’ll update this thread once we can share more details.

Thank you for your help Piotrek!

Trying to understand how PiwikPro code works:

I see 3 connections in my GTmetrix report:

    (60,6 KB compressed / 224KB uncompressed)

    (26,6 KB / 79,3KB)


(0 KB/ 0KB)

Now some questions:

  • Do I need all three of them? What is the 3th one with 0KB? Seems like an empty URL?
  • Will the code be smaller if I add the code manually and do not use the WordPress plugin?
  • Can I deactivate the Tag Manager to make the code smaller?

Thanks for your help :slight_smile:

You can get rid of the first one, but it means basically disabling the Tag Manager module. Requires also some custom code to be added. No. 3 is the actual request that transfers data to the analytics backend, so it’s a must have. Its size is 0 because all the data is passed via GET params or headers.

Thank you for your help kuba!