Viagogo Please Wait pages

Viagogo are in the news again, so I took a quick look at their site. I saw that they are selling tickets – “Only a few tickets left” (on their site says the tiny popover) – for Janelle Monáe at the Manchester International Festival for £75 and up, even though tickets are still available from the official site at their face value of £35 (I also have a spare ticket, get in touch if interested, face value!). So far, so expected.

Checking for availability

But that was not all I noticed. When you first pick a particular performance by someone, you are presented with a progress page, headed:

Tickets for Janelle Monae [sic] - Manchester International Festival are in demand
Please wait while we check for availability
With a progress bar that progresses quite regularly up to 100%. Very regularly, in fact. Almost like it’s a counter, rather than actually checking for availability. And if we look at the source, we find the following JavaScript:
$(function() {
    function a() {
        var f = 700;
        viagogo.events.emit("mainqueue.started", {
            duration: f
        });
        var b = $("#progressbar");
        var c = $("#progressbar > .progressbar-label").first();
        var g = 10;
        var e = setInterval(d, f);
        function d() {
            if (g >= 100) {
                viagogo.cookie.add("flp", true, true);
                clearInterval(e);
                viagogo.events.emit("mainqueue.ended")
            } else {
                g++;
                b.width(g + "%");
                c.html(g * 1 + "%");
                viagogo.events.emit("mainqueue.inprogress", {
                    percentage: g
                })
            }
        }
    }
    viagogo.events.on("mainqueue.start", a)
});
$(function(){
    viagogo.events.emit("mainqueue.start")
});

To sum that up, it is a loop, starting at 10 and counting up to 100 every 700ms, doing nothing much apart from increase the progress bar. When it gets to 100, it sets a cookie and emits an event that is listened to elsewhere, causing the page to update and move on.

Waiting room for tickets

Then after you’ve said how many tickets you’ve want and picked some vastly overpriced tout’s ticket, you’re presented with another please wait page:

It says “Please wait – This may take a few minutes”. Near the end of your wait, you get a message saying “Thank you for waiting – you'll be redirected shortly” And very near the end it changes to a green tick.

Could this be another counter? Yes, it is:

$(function () {
    function startQueue() {
        var internalTimeout = 1000;
        viagogo.events.emit('queue.started', { duration: internalTimeout });
        var $elem = $("#progressbar");
        var $label = $("#progressbar > .progressbar-label").first();
        var width = 10;
        var id = setInterval(frame, internalTimeout);

        function frame() {
            if (width >= 100) {
                viagogo.cookie.add("flp", true, true);
                clearInterval(id);
                viagogo.events.emit('queue.ended');
            } else {
                width++;
                $elem.width(width + '%');
                $label.html(width * 1 + '%');
                viagogo.events.emit("queue.progress", { percentage: width });
            }
        }
    }

    viagogo.events.on('queue.start', startQueue);
});
$(function(){viagogo.events.emit("queue.start")});
This code is identical to the first page, except using “queue” instead of “mainqueue”, less minimised, and a bit slower (1000ms between iterations, not 700ms). There isn’t actually any progress bar on the page, but that doesn’t matter; the display changes near the end of the wait period are purely tied to the loading percentage:
$(function () {
    viagogo.events.on("queue.progress", function (data) {
        var loadingPercentage = data.percentage;
        var $hideWhenLoadAboutToComplete = $(".hideWhenLoadAboutToComplete");
        var $showWhenLoadAboutToComplete = $(".showWhenLoadAboutToComplete");
        if (loadingPercentage === 98) {
            $hideWhenLoadAboutToComplete.fadeOut(500, function () {
                $showWhenLoadAboutToComplete.fadeIn(500);
            });
        }
    });
});

$(function () {
    viagogo.events.on("queue.progress", function (data) {
        var loadingPercentage = data.percentage;
        if (loadingPercentage === 90) {
            $('.js-wait-content').fadeOut(500, function () {
                $('.js-thankyou-content').fadeIn(500);
            });
        }
    });
});

Varying wait times

By trying a few different performers, I discovered that whilst the first page always seemed to currently use 63s as its wait time (10-100, 700ms per iteration), the waiting room time varies by performer – it was 90 seconds total for Janelle Monáe, but only 73.8 seconds for Elton John.

I assume this is how the site manages demand in some way, by varying the wait time for people as the site gets busier (or something like that), but it seems a very artificial way of doing it.