Are you expecting your attached code to work as a hosted web mapping application? If you modify the code in a template, then you need to host the application yourself on your web server. In the future, we may be able to support this workflow, but not currently.
Mike
Hi Wieland,
You can upload your code and share it, but ArcGIS Online does not offer a way to physically host your modified application. Eg. you cannot upload and run a custom API application from ArcGIS Online.
Currently with an Organization, you can control the template apps that the web maps will be viewed in by modifying the application code to accept the web map as a URL parameter, and adding the application as an Item. When you add the application as an item to ArcGIS Online, you provide a URL link to the running application. Eg. http://yourserver.com/CustomApp. A member of your organization will have the option to choose from the different applications you have provided as an Administrator of the Organization. When they open it, it will look like http://yourserver.com/CustomApp/item.html?id=8ab2cce96ba744869227193c4462018c
As Mike mentioned earlier, in a future release we hope to actually host your custom application.
Hope that helps,
Andrew
I have a google analytics script to be added to a webmap. As you know, it's a script that needs to run once for every access. Can I use the "Attach code" functionality to collect statistics on the webmap?