Implementation funnel/progressive scenario

Hello Grafana community,

Is there a way to implement a “funnel” in Grafana k6. I mean : progressively decreasing rate of reaching next page.

The reason is : we try to simulate a realistic ordering/not-ordering e-commerce scenario. And that would not make sens to make 100% VUs reach the “add to cart/order” part of the website.

How would you do that?

Thanks for your help,


Hello @gallart,

Welcome to the forum :tada:

Yeah, I think you can reproduce your scenarios in a more realistic-ish way by following one (or more) of these strategies:

  • Use the ramping-vus scenario to make the amount of VUs to progressively increase/decrease.

  • Use sleep in combination with Math.random() to simulate users behavior (like when looking at a catalog, before actually adding items to the cart).

  • Finally, you can also add some condition, also combined with Math.random(), to make some of your VUs or iterations to follow certain steps, as you suggested, like:

    // Code to add items to the cart.
    // You can add some: `sleep(Math.random() * 15)` to simulate the user is looking over the product catalog.
    // Then, once the cart has some items.
    // You can make that only the ~20% of iterations actually place an order.
    if (Math.random() > 0.8) { 

Beyond that, I don’t think there’s any more concrete way to add realisticness to your tests, you write your test script, you have the power of Javascript, just use it.

Does that help? Are you looking for something more specific?
I’d be happy to help with any other doubt or question.

Thanks! :bowing_man: