I am building a web application and I’m looking to implement the following functionality:
I have a search box on my homepage and users can come and search for topics. This will query a database which then lists a snippet of web page A, among snippets of other web pages (just like a search engine would). Now if the user clicks on web page A on the search results page, it loads web page A, which may within it also contain links to web pages B and C.
If the user exits (i.e. bounces out of) web page A via the back button or in any other way apart from clicking on links to web pages B or C, I want to record this user’s original search query and increment a counter, essentially recording the number of such search queries that resulted in these bounces, along with the exact search terms used.
I guess my question boils down to: Is it possible to do this by tracking back button presses on the user’s browser and recording the data for such cases? (to a first approximation, this would solve my problem). Is such a thing possible using Anvil?
If not, would it be possible to implement this using tracking links, assuming that web page A will publish such tracking links to web pages B and C?