Ad block shouldn't break your checkout

By Mihovil Ilakovac — 2 min read
Ad block shouldn't break your checkout

We've recently started a shop with some merchandise using TeeSpring. We wanted to try out selling merch as a strategy for monetizing our game Bela Online. And while TeeSpring enabled us to set up this very fast and it is a no-brainer in terms of how hands off it is, there are some issues. Some critical issues.

What happened? 🤔

If your customer has an ad blocker enabled which blocks, well, ads, the whole checkout experience breaks. A friend of mine reported it today to me. He has uBlock Origin installed and when he clicks "Checkout" the site doesn't do anything. 😢

The experience just stops, and he couldn't go through with the order.

If you want to try it yourself, here's a link to the store

I've sent a report through a channel intended for reporting issues with your order, but I've also wanted to write this blog post as a cautionary tale for other developers.

uBlock Origin breaks things 😿

So, what is the root cause of this issue? If we look at the code that breaks:

export const getLinkerParam = () => {
  const gaTracker =
  : null;
  return gaTracker
    ? gaTracker.get('linkerParam').split('=')[1]
    : '';

TeeSpring included a check for Google Analytics script and you would think: yeah, they know that could be null.

Error messages

But what uBlock Origin does to alter, makes their check not robust enough. ?[0] : null;

uBlock Origin replaces with a dummy function that does nothing. I suppose they do this if their effort to block the loading of Google Analytics code fails.

This means that the check if the object exists passes, but then the rest of the code explodes. Touché.

TeeSpring, I love your product, please fix this and let's sell some T-shirts 🙂


HN discussion thread: link

If you enjoyed reading this, maybe you'll enjoy reading also about the game we built in React Native during the pandemic Bela Online