This speed optimization guide focuses on the three culprits that are likely to slow down your pages from loading before your Mediavine ads even get a chance to render:

JavaScript, Stylesheets and Third Party Images.

JavaScript is the programming language of the Internet. It's what makes web pages interactive, such as the ability to make a menu drop down or a Pinterest button work. It's also what powers ads. But with all that power, comes great responsibility. Unfortunately, most programmers don't take things as seriously as Spider-Man.

While there's a lot of damage JavaScript can cause, this guide is going to focus on the initial loading of it.

A web page is not considered "ready" until all of its synchronous JavaScript has finished running.

What is synchronous? Think of your computer going through your website code one line at a time to process it. When it gets to "synchronous" JavaScript, it has to stop everything it's doing and wait for that code to finish.

If that's not scary enough sounding, think about what happens when you let a third party run this JavaScript on your site. If they take 10 seconds to "respond" because their server is running slow that moment, they could pause your entire site from loading for 10 seconds. If you haven't finished "loading" your page, you may not have known it in the past. But with Mediavine, this is more important than ever.

Why? Because we don't start loading our ads until your page finishes. We do this to make sure we don’t slow down your site’s load time. We’re using the opposite of synchronous when it comes to our ads. Asynchronous.

Asynchronous means when the browser gets to that line of code, it starts running it and then moves on to the next line while the script goes to complete. That means a script could take its full 10 seconds and you'd never even notice.

So back to why things are a big deal with Mediavine. If you're running a line of third party JavaScript, even if it's in the footer, at the bottom of your page and it hangs - your ads will never load.

Stylesheets, the code that tells your computer how your website looks, and Images, are very similar to JavaScript in terms of how they block the page from loading. The worst part is, without fancy code like lazy loading for images - they’re all synchronous.

If you run even a single third party image or stylesheet, you’re completely at their mercy.

So what’s the solution?

First, we’ve created a tool that helps you identify the synchronous JavaScript and third party images and stylesheets that could potentially stop your site from loading.

When it comes to JavaScript, you can work with the third party to make it asynchronous. Sometimes that’s as easy as literally adding 5 characters to their script (async). If they’re unable to do so, you should remove them until they do.

When it comes to images, you should host these locally on your web server or CDN that is hosting your other images. If they’re requiring you to run an image as a tracking pixel - you shouldn’t. Unfortunately, there’s no easy solution for third party images short of writing complicated JavaScript code to load the image after the page is ready.

For stylesheets, it’s a similar issue as images. You’re going to need to switch to hosting these locally or on your CDN. The code required to load Stylesheets asynchronously is also complex.

Now onto the tool!

Just enter in your URL (you should do both your homepage and an article) and the tool will output any “external” (both third party and your own site’s JavaScript that lives in files is considered external) JavaScript as well as any third party stylesheets and images.

You’ll get some instructions on the tool page, but the idea is simple. 

You need to get rid of all of that synchronous JavaScript and any and all third party images and stylesheets. 

You should have literally 0 synchronous JavaScript and 0 third party images and stylesheets when you’re done. Leaving just one still leaves you vulnerable. Any time you add a new plugin or third party script, please re-run this tool to make sure you didn’t install any new bad scripts by mistake!

Remember, please run the following tool on both your homepage and an article page in case they run different scripts:

Mediavine Third Party Auditor Tool

Did this answer your question?