Forum Academy Marketplace Showcase Pricing Features

Tracking page views

I’m tracking page views and plotting them on a chart. Each ‘day’ shows it’s corresponding ‘views’.

The first view of a page on any given date creates the database entry if it doesn’t already exist. Then subsequent views just increment the value by 1. The next day the process repeats.

The issue I’m facing is that if nobody views a page for a particular day, then database entry for that page on that day is not created and my graph doesn’t have any data to show.

How would I automatically create an entry for every day, even if it is 0 without manually doing it for each page I’m tracking?

You can schedule a backend workflow to create a new entry every 24 hours. then just make the updates to that entry when people view your site.

I had looked at that but it wasn’t immediately obvious how to set it up. Should I be using ‘New recurring event…’ and then somehow running it every 24 hours?

You can do that (although you have to be on the professional plan to run daily recurring workflows).

Otherwise, just create a backend workflow that creates a new entry, and the schedules itself to run again 24 hours later, or at a specific time the next day (i.e. 00:00).

Then you need to trigger it initially to run at a set time (from an admin page, or temporary page) to get it going (if you trigger it in the dev version of your app it will only create entries in your dev database, so be sure to trigger it in the live version as well once you need to).

1 Like

I wish Bubble could allow us to set initial schedule in the backend. Imo the trigger via temp page is not very clever or safe.


Forgot to reply! Thanks @adamhholmes, have scheduled API workflows as you suggested.

For anyone else looking to do this I used this as reference - [New Feature] Scheduling API workflows can now be done recursively

1 Like