You might need to insert custom Javascript code to WordPress header of Footer when developing your own plugin.
There are couple of ways to do this.