Change URL reference for Javascript Code

I was working on my localhost when I setup piwik. So when I created my first site, it used as the url in the javascript. How can I change this or can I not? I did just paste the javascript into the site, and then tried to manually change localhost to the DNS, but it didn’t work. Also it could create some problems later.
Last, what if I changed the server and DNS that this was hosted on. Like, to, how would I force that to change?

please just go to piwik, Admin area, Sites, show javascript code. This will give you the valid code with the right piwik URL. Replace your existing code with this code.