Count file downloads

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • In Progress
Pretty much the title. I want the ability to track the # of downloads of a file attachment. Creating a document hosting app and would like to see uptake and use of the files within this app.

Non-native approaches welcome
Photo of G.Macri

G.Macri

  • 878 Points 500 badge 2x thumb

Posted 8 months ago

  • 0
  • 1

You could add a rich text formula field that runs some JavaScript. The script should first do something to "count" the number of clicks and then redirect to the URL of the file.
Photo of Avi Sikenpore

Avi Sikenpore

  • 590 Points 500 badge 2x thumb
Another easier alternative is to provide a formula URL download button which first creates a child record with the file information and then downloads the file.

Essentially use a API_AddRecord and then do a rdr to the download link. 


copied from the QB API guide (https://help.quickbase.com/api-guide/index.html#filemanagement.html%3FTocPath%3D_____5 )
------

ou can download a file in two ways:

  • If you know the database ID, the record ID, the Field ID of the file field you are attaching to, and the version ID, you can use issue a GET request using this URL format:

    https://<em alt="" title="" name="" value="" type="" target="" rel="">target_domain</em>.quickbase.com/up/<strong alt="" title="" name="" value="" type="" target="" rel="">DBID</strong>/a/r<strong alt="" title="" name="" value="" type="" target="" rel="">RID</strong>/e<strong alt="" title="" name="" value="" type="" target="" rel="">FID</strong>/v<strong alt="" title="" name="" value="" type="" target="" rel="">VID</strong><br alt="" title="" name="" value="" type="" target="" rel="">

    where:

    • target_domain is the domain against which you are invoking this call, for example, quickbase.comRead about this notation.

    • DBID is your TABLE dbid (not the application dbid)

    • RID is the rid of the record with the File attachment

    • FID is the fid of the File attachment field

    • VID is the version ID of the file. Specifying 0 (zero) for the VID always gets you the most recent version.

    For example: https://quickbase.com/up/bdb5rjd6h/a/r13/e8/v0

  • If you know the URL of the file attachment, you can issue a GET request that contains the URL of the file attachment and the table dbid. (To get the URL, use API_DoQuery if and set its fmt parameter to “structured.” The URL is returned in the <url></url> tags.)

    Here’s a typical URL that you would use in this second way of doing a GET:

    https://<em alt="" title="" name="" value="" type="" target="" rel="">target_domain</em>.quickbase.com/up/bdb5rjd6g/g/rz/ey/va/Model_T.jpg