I am trying to async the google map api javascript.
So, the normal script tag works
Adding a comment here since I struggled a fair bit with this problem. When loading the script asynchronously (via a button click for example), make sure you follow the instructions exactly as on the site.
I first got the document.write error when I didn't give the callback value. And after giving the callback, I got the window.initialize error because ... duh ... there was no initialize function in my code. I changed that to my function name (something like loadMap) and it started working.
To be honest, just copy the code from the site and it should work. Replace window.onload with whatever you need to trigger the said function.