Mobile app version of vmapp.org
Login or Join
Deb1703797

: Tracking state of a one time event on a big website Assume a website with 250 million active users. I add a new feature to the website. Once a user visits I want to use a short tutorial

@Deb1703797

Posted in: #Database #Performance #WebDevelopment

Assume a website with 250 million active users.

I add a new feature to the website. Once a user visits I want to use a short tutorial to teach them how to use said feature. I only want them to complete the tutorial once (or actively click it away).

What is the smart way to code the verification check for this? How do I track the progress in the database? Having a separate table with like NewTutorial_completed = 1 for user_id = 21312315 would just snowball. It also feels intuitively bad to check for every one-time event for every user on every page view.

While writing the question I got one idea, to have a separate event log that is checked periodically for any new action the user need to see or perform. I push events to this log and once they are completed they are removed from the log. No need to store NewTutorial_completed = 1-type variables this way.

I am sure this is a common problem. I would appreciate any input on what best practice is.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

2 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

A whole new database table would certainly be overkill. It is fairly common practice to use add a column to the exist user table for something like this. Presumably you have a user object that gets loaded from the appropriate row of this table and that object could be extended as well.

Doing that implementation requires:


A database migration to add the column
Addition of the field to the user object
Changes to the CRUD code that loads and saves these objects from the database (hopefully you have a good ORM layer that makes this easier)


Recently I have started using no schema storage for items like this. Take a page out of the NoSQL playbook. I create one column in the user table that stores many such pieces of data. The column is a TEXT column. The field is populated with a JSON representing many such pieces of information about the user. Loading and storing info to this column is pretty easy with object to JSON mapping libraries such as Google's Gson library.

Once this column is in place, tracking new items about the user is as simple as writing the object code. No database or CRUD changes are required.

The disadvantage of this approach is that it is hard to query these values. It is harder, for example, to query the database for a list of users that have taken the tutorial.

10% popularity Vote Up Vote Down


 

@Shanna517

Reading this the first thing that comes to mind is a cookie or session variable. You might implement something such as your NewTutorial_completed and have it read it only once when the cookie or session variable isn't set, such as upon a login.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme