Google I/O 2013 registration page: under the hood

I’ve tried registering for Google I/O from 3pm till 3:55 pm (GMT+1 time).

Screen Shot 2013-03-13 at 16.50.56

While trying and waiting, I checked out their javascript code. There’s actually not much to it:

q.registration.checkWaitListStatus = function (a, b) {
	var d = "/events/register/noticket/" + q.registration.waitListKey + "/";
	b && (d = "/events/io/register?tryagain=1");
	var e = "/events/register/waitlist/status/" + q.registration.waitListKey + "/";
	$.get(e, function (e) {
		var l = e.status;
		"waiting" == l ? a.setTimeout(q.registration.checkWaitListStatus, 25E3 + 1E4 * Math.random(), a, b) : q.location.href = "fulfilled" == l ? e.redirect_url : d
	}).error(function () {
		q.location.href = d
	})
};

The checkWaitListStatus function checks the following url every 10 seconds or so: https://developers.google.com/events/register/waitlist/status/googleio2013_academic/ for academic tickets or https://developers.google.com/events/register/waitlist/status/googleio2013_general/ for regular tickets.

The urls return a JSON object containing either

{"status": "waiting"}

 

{"status": "reregister"}

or…

{"status": "fulfilled", "redirect_url": "/events/register/waitlist/claim/googleio2013_general/"}

So what happens in this line of code:

var l = e.status;
"waiting" == l ? a.setTimeout(q.registration.checkWaitListStatus, 25E3 + 1E4 * Math.random(), a, b) : q.location.href = "fulfilled" == l ? e.redirect_url : d

Let’s rewrite it based on the code around it:

response.status == "waiting" ? window.setTimeout(registration.checkWaitListStatus, 25E3 + 1E4 * Math.random(), window, true) : ( window.location.href = (response.status == "fulfilled"? response.redirect_url : "/events/io/register?tryagain=1") )

That means, if status equals “waiting“, then retry after some time, else set window.location.href to “/events/io/register?tryagain=1”. Except when status equals “fulfilled“, then set window.location.href to redirect_url

Now here’s the interesting part. The time it waits is actually a random value between 25E3 and 25E3 + 1E4 milliseconds, which boils down to 9699 and 10183 milliseconds. Now, if was paying more attention, using the live debugger, I could’ve just changed the javascript code 25E3 + 1E4 * Math.random() to 100 for example 🙂 So that it checked the registration url faster.

But I didn’t… My adrenaline was to high and I couldn’t think straight…

But next year, I will be prepared.

Advertisements
Posted in Uncategorized
2 comments on “Google I/O 2013 registration page: under the hood
  1. Anonymous says:

    If requests to the status page were made more frequently than about every 15 seconds, the server would automatically return a reregister status. I actually gave up on the waiting page and just set up an auto refresh on the status page. Managed to get awarded a ticket about 3 times that way, but wallet crapped out every time.
    Next year I’m writing a custom waiting page that does all that for me!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s