Item Download Counts and Python

820
5
05-02-2022 11:54 AM
KansasDASC
New Contributor III

In ArcGIS Online, for each item, there is a metric showing how many times the item has been downloaded within a specified time-frame. How can we get at that count using programming to automatically pull this for a weekly/quarterly report? We have several hundred items that we track within our organization and we need to report on how many times each item has been downloaded. Is this possible, either through the API for Python or something else? We've already explored Google Analytics which was only reports how much a item type (shapefile, GeoJSON, KML) has been downloaded. It doesn't tell you what those items actually were or what their AGOL IDs are, either. I do not want to write down a number for a couple of hundred items, so automating this is preferable.

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

Check out arcgis.gis.Item.usage(), that should do what you want. This actually returns a dict or dataframe, so you could easily convert that to a CSV, or append the information to a large master file, etc.

It runs per-item, so you'd need those hundreds of items as a list. Or else you could just run it against every item in the organization, then filter it on the other end of things, like in a Pivot Table.

- Josh Carlson
Kendall County GIS
0 Kudos
KansasDASC
New Contributor III

Thanks, Josh. This is sort of in the right direction, but looks restricted to only items in ArcGIS Online? Downloadable items in AGOL are CSVs, PDFs, etc. When you have items shared with Esri Hub, you can download feature layers or web layers in different formats. I should have specified, but we're trying to track downloads of items through the Hub. The usage() solution might only work on AGOL items and of certain types.

0 Kudos
EmilyMc
New Contributor II

Hi @KansasDASC , did you find a solution to this requirement? 

Thanks! Emily

0 Kudos
KansasDASC
New Contributor III

Hi @EmilyMc . No solution yet. Now that Google UA is no longer a tracking component in Hub, the number of downloads per Hub item isn't discoverable and it's not clear how to locate that attribute in GA4. Downloads can be tracked for items but we need it to go a step further so we can figure out how people are using our Hub site.

EmilyMc
New Contributor II

Hi @KansasDASC , Thanks for the insight! Thats great to know.

0 Kudos