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.
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.
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.