Hackernoon logoHow Changing Ad Networks Made My Site 8x Faster by@shanelabs

How Changing Ad Networks Made My Site 8x Faster

Shane Labs Hacker Noon profile picture

@shanelabsShane Labs

Side Project Entrepreneur

This is a story about how I made a simple (stupid) choice to switch ad networks to increase ad revenue by a few percent. Yet it ignorantly turned a <2 second load time into an average of 15 seconds. Never again.

Skip to the bottom for a TLDR;

A Simple Site

I have a variety of sites that I build for myself, and then put up on the web in case others enjoy it. If it gets enough interest, I’ll slap some ads on there in hopes it helps pay for the hosting.

One of those sites is an easy tool that helps you find the musical key of a song. It’s been around since 2011, gets about 1k visitors a day, and brings in a bit under $100/month in advertising revenue with a single Google AdSense ad in the footer of the page. Nothing to brag about, but hey — pays the bills and then some.

A Competing Ad Network

So when another ad network approached me guaranteeing they’d pay more than AdSense, I figured I had nothing to lose. They set me up with an account, gave me a snippet, and I swapped it in for a few days to see how it performed.

They were right — stats showed I was earning a little more than from Google, and the ads didn’t seem to be any more obtrusive. When I confirmed they paid out, I decided to keep them on full time.

It was additionally reassuring to do business with this other ad network because they gave me attention. There were real humans that I could talk to (I’ve never heard a voice on the AdSense side). They wanted me, and in a world of being reduced to numbers, that felt nice.

A Few Months

Things carry on for a couple months with no big changes. Site hums along. Ads get served. I get paid. Sweet.

Yet when I looked at my overall earnings and compared them to what I was making with AdSense, it didn’t seem to be much higher. Stats told me I was earning $1.00 CPM compared to $0.83 CPM with AdSense, a figure that should give me an additional few rounds of beer at the end of the month. But my bank account balance wasn’t really showing that.

(For the record, I understand that a $1 CPM rate is pretty low. I know I could place more ads, and put them in more prominent positions to increase that, but I don’t want to annoy my visitors. This is just fun money and not worth it to me).

Despite the overall non-increase in earnings, I decided to keep them on for one additional reason: insurance. I’ve heard horror stories about AdSense accounts getting shut down with little-to-no explanation and no real ability to appeal. This alternative could be a great partnership to rely on in the event Google ever decided I smelled.

So I decided to keep their ads running. No harm in continuing to use them, right?


A Site Speed Tool

Another project of mine had been a site speed analytics tool. It runs a speed test at regular intervals, with varying configurations. In looking for sites to test out my new tool, I added all of my own sites.

I instantly saw an outlier:

Any of these sites stand out to you? Blue line, we’re looking at you!

That blue line above looks horrendous! Anything above a 5 second load time feels dirty to me. But being consistently over 15 seconds?! That’s just glutton.

And yes, if you guessed that the blue line is the site we’ve been discussing so far, you’re right.

Investigating Further

I took a look at the detailed view for these long page load times, and it didn’t take a rocket surgeon to figure out what the culprit was:

Over 200 requests on ads alone!

I was shocked. Not only at how the site without ads consisted of 6 resources and all the rest was for ads — but how obvious it was! Have you ever seen so many ad pixels in your life? I needed to take a shower.

I instantly pulled the ad code and put AdSense back on. Check out the difference — can you guess what date I made the change?

Reverting the new ad network’s snippet back to AdSense

And here’s what a normal page load looks like now:

256 vs 22 requests.

16.5 vs 1.5 seconds load time

530 vs 368 KB — okay that one’s not as dramatic, but anything lighter is better to me.

Keep in mind — there’s another important metric here: Speed Index. It’s a measure of the perceived page load, and basically measures when the page is mostly done visually changing. This is done by taking screenshots at intervals and comparing them to the final loaded state. For example, the whole page may take 5 seconds to render, but if at 2 seconds it doesn’t change much aesthetically (perhaps it’s just loading some ads for the last 3 seconds), then the speed index is 2000 (the metric is unit-less since it’s not actually measuring time, but you can think of it as 2000 ms). In this case we’re looking at a speed index of 1140 vs 640. Almost cut in half, but the original wasn’t too bad to be honest. However, having an extra 200+ requests still just makes me cringe.

I decided to look at other aspects of performance. Perhaps there was just a specific region that was dragging things down? Or maybe desktop was performing poorer than mobile traffic?

Checking out the different from different regions, devices, and views.

While there were some areas that performed better than others with the bloated ad network, it was apparent that every single scenario was better off without them.

The Ad Network Responds

After a few days, someone from the ad network actually reached out to me, saying they noticed we removed the code and asking if there was anything they could help with. Remember how I loved that they gave me attention? That there is another example — they actually did it very tactfully, didn’t feel creepy.

I told them what I had found out, showed them some graphs, they they actually offered to ‘optimize my snippet’ so it performed less requests. Not sure why they wouldn’t have given me an optimized snippet in the first place, but I gave them a chance to redeem themselves and reinstalled their pixel.

Unfortunately it was still no where near close enough. Through my site speed stats I could see that it performed a little better in 2 regions (~10s), but another region performed even worse (>60s!). No thank you.

I have reverted to AdSense for good.

Note —I’m purposely not naming this alternative ad network. They are made of good people and perhaps have a good solution for some, just not me. I didn’t want this post to blame anyone, simply to make others aware that tiny changes have big effects on your speed. Also note that I am in no way affiliated with Google or AdSense.

Lessons Learned

If you skipped to this TLDR, here’s what you should know:

  • A little increase in ad CPM may not be worth it in the long run. Site speed, which affects SEO and visitor engagement, is an important aspect to consider.
  • Who knew a single javascript snippet would have the balls to load 20x the resources than the site itself. Who knew there were >200 ad pixels around?
  • While there are AdSense alternatives out there, they still dominate in terms of advertiser supply, payout, and speed.
  • Shameless plug — always be aware of your site speed (don’t just check it once!). Check out my speed metrics tool to get your site monitored regularly: MachMetrics


Join Hacker Noon

Create your free account to unlock your custom reading experience.