Possible to override a core file functionality?

Is it possible to override functions of discourse/app/assets/javascripts/discourse/lib/click-track.js.es6 with slightly modified one?

I want to change line #46

I am looking for a method which won’t lose changes when discourse is updated.

You might be able to get away with a theme. If not, then you’ll have to write a plugin.