Yes there is a way to do this using a Service Worker. You can do this in Chrome, FireFox, Opera today and on or about Otober 17 in Edge.
Rather unexpectedly a new development has happened in that Clourflare (a hosting company)has adopted the Service Worker API that works server side rather than client side (in your browser) and created a jsfiddle.net like playground were you can implement a Service Worker to operate against any domain and share it. So that is exactly what I have done here:
Feel free to load this page and navigate around my QuidkBase applicaiton. If you choose either of the two predefined CSV reports (CSV1 or CSV2) they will download in the usual fashion the CSV file as well as be logged to the Log table automatically by the Service Worker. This just a simple demo where I am only detecting the qid=5 or qid=6 reports are being requested but a more comprehensive logic could detect other CSV export URL by various other means.
Here is the code shown in the playground highlighting the regular expressioin I am detecting
var dbid = "bm5tmtkbc"; var dbddTable = "bm5tmtkbx"; var dbddLogs = "bm5tnrevv"; var apptoken = "dkcygh3dsf2nsbpzkj2kyar2xj"; addEventListener("fetch", event => { event.respondWith(fetchAndLog(event.request)) }); async function fetchAndLog(request) { let response = await fetch(request); let re = new RegExp(/bm5tmtkbx\?a=q&qid=5|bm5tmtkbx\?a=q&qid=6/); let urlVisited = request.url; if (re.test(urlVisited)) { var formData = new FormData(); formData.append("_fid_6", urlVisited); await fetch("https://haversineconsulting.quickbase.com/db/bm5tnrevv?act=API_AddRecord";, { method: "POST", body: formData }); } return response; }
This same code can be used for a Service Worker in your browser today to accomplish the same thing