Tabs for everyone: We fixed an annoying bug on

(No, not those tabs, these tabs)

For the past couple of years there’s been a persistent bug on It wasn’t a big bad bug that caused the website to break or put any users at risk. It was more of a small annoying UI bug that certainly caused frowny faces, sad pandas, and feelings of frustration for our users.

[Editor’s note: Can confirm. It was super annoying.]

The problem started when we upgraded to a new Google Analytics tracking code that broke the default browser behavior. If you are used to browsing the web using tabs—and tab-opening shortcuts like middle-click and cmd+click— and you tried that on, then instead of a new tab our Analytics script would open the link in the current window. Man, we were being Richards.allthetabs

It’s not that we didn’t want to fix it. We really wanted to, but there were bigger projects we had to complete (like a mobile-friendly design). This just got pushed down the queue until we finally took the time to sit down, understand the problem, and figured out how to fix it. We added some extra javascript to detect what our users wanted to do and then open a new tab when they wanted it. There’s a small chance that it affects our Google Analytics tracking, but if it means a better user experience we think it’s worth it.

We’re sorry for hijacking your default browser behavior for so long, but we promise to keep trying to make better and easier for you, our beloved customers. So go ahead, click away, and use tabs on to your heart’s desire, and we’ll keep working hard to give our customers the best user experience when searching for, buying, and managing domains.

Now, the more technical version, if that’s your sort of thing:

Maybe you got here by searching Google for “How to fix Google Analytics” or “e.preventdefault breaking tabs,” so here’s the technical explanation of how we fixed it. Our GA implementation is very robust and flexible, allowing us to heavily leverage event tracking and behavior tracking. All this is done so we can use data to inform our decisions on what to improve upon and how. However, this tracking also uses e.preventdefault to delay links with GA tracking by 200 milliseconds to allow the tracking to fire and get tracked by Google.

By adding this prevent default we were stopping the default browser behavior of new tabs. We had some limited code in place to allow target=”_blank” to ignore the tracking and render properly, but we didn’t detect when a user clicked with the middle-mouse button or while holding the CMD/CTRL keys. Our solution was to wrap our Google Analytics tracking code with some simple javascript that detects keypress and mouse click and allows the proper browser default behavior to work.  The code looks like this:

//detect middle mouse click or cmd/ctrl click
if(!e.metaKey && e.which != ‘2’ && !e.ctrlKey) {
//run scripts with e.preventdefault