Week 8: Creating the Database Tables for Counting Views and Tracking Visit Times
- Julia
- Jun 25, 2019
- 1 min read
After hearing Boris's feedback today that the core functionalities of the installation must be ensured by Friday, it was clear for us that my priorities as a web developer should lie on ensuring that we can collect all the data that we need and that the website goes live. For the former task, I created two new tables in my database - one for counting the unique views with the respective access time of the letter page and another one for the total views per page.
What Do We Need the Tables For?
In particular, we want to know:
When and at time each of the letter pages is visited → keeping track of every single page visit
In total, how many visitors each of the pages has during the exhibition days → keeping track of the accumulated page visits
Realisation
For the single page visits, we created a new table in our database that tracks the date, time, datetime, page URL and web page title. Whenever a one of the eight letter pages is loaded, a new row is added to the table.

For the accumulated views, a table with eight rows is created, displaying the page name and the view count. Whenever a page is loaded, the respective view count in the table increases by one.

To include the view and time tracking into our website, just a few lines of PHP code are necessary on each of the letter pages, here shown in the example of “Events”.

And that's it! I tested the functionality a bit, and it works perfectly! I got it done faster than expected!
Comments