Real-Time Website Visitor Conversion Prediction

When searching tools to optimize our product pages’ conversion rate at Grew, I couldn’t find a solution that is easy to implement, privacy-friendly, and that would allow us to personalize our front-end based on user behavior automatically. To achieve this I have started to implement a machine learning based solution that uses event data (eg. time on page, bounce, link click, subscription, conversion, signup) and device related data (eg. device type, browser, time zone) to build a real-time conversion prediction system.

My goal is to keep the system safe and light by using only non-personal and non-sensitive data and not use cookies. The central hypothesis is that when we have collected enough data, our model can create segments and audiences based on the input data for creating a prediction model that can identify in real-time during a website session the likelihood a visitor will convert.

Currently, the client-side package consists of two parts:

  1. A script that tracks and sends the website visitors’ device and event data to a tracking API. By default, the script tracks bounce and click events and device-data, but I can pass any events using a simple function.
  2. A script that calls the prediction API, which returns the predicted action the user will take. The data also predicts how many seconds after the pageload the user will do the predicted action.

If you are interested, all the client-side scripts are in use in this Github repo.

On the back-end, I use brain.js neural network that categorizes the event and device data it gets from the 1st tracking API. The output is a prediction model that serves the action and timing predictions to the 2nd prediction API. We upload the trained neural networks to a mongoose database.

Testing in production

We are currently testing the solution on our product pages. An example use case is currently live on this page, where we use the solution to optimize the timing and targeting of our newsletter subscription popups. If you want, you can go there and inspect the console to see what is your prediction.

Alternative, you can try the solution here.

Next steps

After running the initial tests and analyzing the results, my plan is to develop this into a “next-best-action” tool. Instead of running segment-based predictions, the solution should continuously update the predictions during a session according to the visitors’ actions on the page. Let’s see how far I get. I’ll keep posting news about the progress.

Co-Founder @Grew Creator of,

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store