Attaching code to web app in AGOL4Org

4561
7
05-18-2012 08:28 AM
AndrewZimba
Occasional Contributor
I've started messing around with our ArcGIS Online for Organizations trial.  I've created some feature services, combined them into a web map, and used the configurable templates to share the web map out as a web app.  I've noticed on the details page for the web app there is a "Configure App" button and an "Attach Code" button.  "Configure App" is pretty self-explanatory, but i cannot find any info in the Help about how to use the "Attach Code" feature.

Where should i be looking for information about the capabilities of attached code and how to structure it to get something desirable to happen?
Tags (2)
0 Kudos
7 Replies
MikeMinami
Esri Notable Contributor
Attach code is not a mechanism for adding a custom feature to an application. It's simply a mechanism for people to share code and allow others to download it. For example, many people want to share code samples. This is how they would do it.

Thanks,

Mike
0 Kudos
AndrewZimba
Occasional Contributor
Um... OK, but why would that button be available on the details page for a web application and not a web map or feature service?  That sort of implies that it has to do with Web Applications and not other content types.  Right?  If not, maybe it shouldn't be included on that page but somewhere more logical.
0 Kudos
MikeMinami
Esri Notable Contributor
Web mapping application is a generic item type. For instance, a local city may want to publicize their pothole reporting website. They would do so using this type. Others may have created an application they want to share and attach code to so that other people can modify/deploy the application themselves, like this one:

http://www.arcgis.com/home/item.html?id=fa8a71c3039846c3b97c0e0f545dcda9

We also happen to use the same item type to store our template applications we host that people can drop a web map into. You can publish these to ArcGIS Online and they're hosted for you. Alternatively, you could download the code for the application, make modifications, and then deploy a customized version to your website. It's a quick way to get a web application up and running.

What would be the use of attaching code for a web map or a feature service?

Mike
0 Kudos
AndrewZimba
Occasional Contributor
I think I get it.

So if you take a web app you've coded and register/share it within AGOL, you can the attach the code to it for others to download and work with.  The button just has no real function for a web app created from a web map totally within the AGOL environment because there's no code for it.
0 Kudos
JosephJose
New Contributor III

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?

0 Kudos
Reynaldde_Castro
Occasional Contributor

I don't think you can use 'Attach Code' for that according to Mike Minami.  Have you tried adding the script when modifying the title or header?  You can include some html code when changing the title.

0 Kudos
MikeMinami
Esri Notable Contributor

Joseph Jose‌ - there is no support for attaching or running code from a web map.

Reynald de Castro‌ - your idea won't work as we strip out or escape HTML that can be potentially malicious.

Thanks,

Mike

0 Kudos