Hi Aryan,
I am with Michael on this one, and these things need extensive testing (as well as being mindful of the three weekly update cycle that you should test the custom javascript prior to each release).
I have toyed around with HotJar using a custom JavaScript injection which worked really well in the past, so, in theory these sorts of things are possible with the same caveat Michael mentioned (ensuring you don't break Canvas with conflicting code).
I also wanted to flag something else I saw with what you linked to, it talks about logged out users (i.e. guests to a site) however when you put the code in Canvas, these people will be logged in. It is good to remain mindful of Javascript injections having potential access to information loaded within the screen when it loads for a user, so, I recommend making sure you are aware of what data the application is collecting about the browser/session/etc to make sure it only does what you intend.
Definitely give it a go in test and let us know how you get on!
Stuart
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.