Discussions

Expand all | Collapse all

Count file downloads

  • 1.  Count file downloads

    Posted 11-07-2018 16:59
    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


  • 2.  RE: Count file downloads

    Posted 11-07-2018 17:55

    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.


  • 3.  RE: Count file downloads

    Posted 11-07-2018 19:07
    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