Can I install Freshpaint on a Chrome extension?

Yes! Here is a demo: https://github.com/freshpaint-io/demo-extension-tracking​

Extra Steps for Manifest V3

Chrome's newer manifest v3 imposes certain constraints on how an extension's code is architectured. Specifically, it does not allow extensions to load code from external domains, all the code used by the extension has to be packaged with the extension statically.​

Usually the Freshpaint tracking snippet that you get from https://app.freshpaint.io/sources loads the Freshpaint snippet from our CDN. This cannot work from the context of a manifest v3 extension. So you'll have to download a few scripts and place them in your extension directory -

 -p freshpaint/static/js
curl https://perfalytics.com/static/js/freshpaint.js > freshpaint/static/js/freshpaint.js
curl https://perfalytics.com/static/js/analytics.js > freshpaint/static/js/analytics.js

Next, you'll need to make small modifications to the Freshpaint tracking snippet.​One thing to keep in mind is that the Freshpaint snippet needs to be loaded from the action script of your extension. We'll autotrack all the UI elements from there. Since the background service worker does not have a DOM, as of now we don't support loading Freshpaint from there.

Last updated