Forum Discussion

CassandraFriend's avatar
CassandraFriend
Qrew Member
4 months ago

Tracking Traffic

Hello,

I have a client who is wondering if it is possible to track the visitor traffic to the code page/form we made for them in QuickBase. 

Is there anyway to possibly do this? Even something like increasing the number in a field by 1 every time someone opens the page will do. 

4 Replies

  • If it's already in a codepage - you can simply have a function that runs on load to make an API call that adds a record into a table for 'logs'. Just a simple function posts to this table - and you can report off of Record Owner and Date Created as a way to report on traffic to look at users and times of day.  



    ------------------------------
    Chayce Duncan
    ------------------------------
    • CassandraFriend's avatar
      CassandraFriend
      Qrew Member

      Thank you! Do you by chance have an example of what this function might look like?

       



      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        This is quick and dirty but does the trick after you input your realm name, dbid and apptoken if required. 

        const track = (() => {
            let realm = ""; //insert your realm here;
            let dbid = ""; //insert dbid of your table here;
            let applicationToken = ""; //insert your apptoken here if required for your app;
            $.ajax({
                url: `https://${realm}.quickbase.com/db/${dbid}?a=API_AddRecord&apptoken=${applicationToken}`,
                method: 'GET',
                success: (result) => {
                    console.log(result)
                },
                error: (err) => {
                    console.log("Your record did not save", err)
                }
            })
        })()
        Just make sure that you have jQuery installed in your <head> - you should have something like this: 
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>


        ------------------------------
        Chayce Duncan
        ------------------------------