Oops! I misunderstood.
I am not sure whether you had already gone through with the below and was this helpful in your case or not.
Yes, you would need to add the code from the js into the pre-execution script. Since the js is 283kb, it is above the default size for pre-execution scripts, 50kb, so for the moment, you will need to create a Support ticket and request that this setting is increased. Soon you will be able to do this in the monitor itself, in a new Advanced Settings tab. 🙂