I need to create an alerting bot for anomaly on data regarding funnel monitoring of different product on my company website.

The specific metrics I need to monitor are:

  • The conversion rate between users who visit our website and those who start the funnel.
  • The conversion rate between users who start the funnel and those who reach the end (Thank you page).

After a bit of experimenting with complex models (using pyOD, adtk and darts Python library mostly), I found out that the simpler the better and I'm using the Interquartile Range (IQR).

Each day, for each metrics, I will send an alert if the current value is lower or greater than [Q1−1.5IQR, Q3+1.5IQR] , where IQR is calculated on the data of previous month.

The only drawback is that my data has a weekly seasonality (visits peaks on friday and decrease on weekend) that leads to frequent false positives and false alarms on weekends.

Do you have any suggestions on how take in account the seasonality and still using IQR?

Thank you!


1 Answer 1


The simplest method would be to calculate not one, but seven IQRs, one for each day of the week. Then you should of course use a longer history, e.g., the last half year, giving you about 26 data points for each day, comparable to the 28-31 days of the last month you are using right now.

You might be able to pool some data: instead of treating each day of the week separately, pool Monday through Friday and the weekend separately. Take a look at your traffic and check whether there is an actual difference between these days.

The more complex method would be to fit a forecasting method that accounts for this seasonality and provides prediction intervals. There are very simple exponential smoothing or ARIMA implementations. Then "forecast" from the data up to yesterday into today and check whether today's observation is outside a (say) 98% prediction interval.

This more complex method has the advantage that it can be extended to more complex situations, e.g., if you find that you do not only have weekly seasonality but also yearly seasonality () or trends.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.