This system is designed to build a loyal customer base over the years and will encourage clients to purchase the best selling product every time. Although this idea may work for any B2C entreprise, we will for example consider the store to be "Barnes and Noble"
How to:
Create an account on Firebase by clicking here. Then you click on "+ Add project". On reaching your page, you click on database and scroll to realtime database and click on "Create Database"
You can then enter all the customer data by clicking on the plus sign and even use nesting in order to create a database of a customer.
You then attach the firebase data to your code by going to authentication and clicking on web setup. You also have an option to export the database in the JSON format and linking it to the script.js file using $getJSON command
We get access to the database in order to query by using the following command:
var database = firebase.database();
And you can access any of the variables; for example, you can access the name using the following command:
var nameRef = database.ref( "Customer Database/Name" );
Since every purchase is updated onto this database, querying the customer-ID would give us the number of times the customer has purchased from us.
1. First we assign the Variable to the customer db:
var usersRef = database.ref("Customer Database);
2. We then upload the JSON file onto the program as mentioned above, although as usually you will already be having a daabase in the system, that will not be required.
3. Query the database:
Hence having a database maintained is very useful for many causes in a company such as analysis of data and prediction of customers, to detect faults in the DB etc. And this idea in particular will encourage an increase in the number of customers