How to avoid Google Ads from slowing down my site (Especially Mobile)?
Asked Answered
I

2

12

I know that many webmasters believe that page speed means nothing. However, I’m confident that this factor is one of TOP 3 in the Google’s decision of ranking any website.

I tired of seeing how Google’s own services are slowing down my pages. I write clean code. When I launch any website/app, it scored “A” on GTMetrix and Pingdom and 100/100 on Google Page Speed (Mobile). As a rule, Google Ads don't harm the desktop version.

However, once I add at least one Google Ad, my ranking drops down to “C” and 60-67/100 (Mobile).

Of course, one may say that Page Speed is not an SEO ranking factor. Ok, for NYT, WSJ, Bustle, HuffPost, etc., may be. But for any new website, the speed is a crucial factor.

The injustice is that Google point out its own services, which slow down my (and your) projects, such as:

There are 6 static components without a far-future expiration date.

https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
https://code.jquery.com/jquery-3.3.1.min.js (not Google)
https://adservice.google.ca/adsid/integrator.js?domain=xxx
https://adservice.google.com/adsid/integrator.js?domain=xxx
https://pagead2.googlesyndication.com/pub-config/r20160913/ca-pub- 
xxx.js
https://fonts.googleapis.com/css? 
family=Open+Sans:400,700|Roboto:700&lang=en

Reduce DNS lookups:

pagead2.googlesyndication.com: 6 components, 368.9K (136.4K GZip)
code.jquery.com: 1 component, 86.9K (30.2K GZip)
adservice.google.ca: 1 component, 0.1K (0.1K GZip)
adservice.google.com: 1 component, 0.1K (0.1K GZip)
googleads.g.doubleclick.net: 11 components, 173.4K (45.9K GZip)
fonts.googleapis.com: 1 component, 7.0K (0.6K GZip)
tpc.googlesyndication.com: 5 components, 153.0K (57.0K GZip)
www.google.com: 1 component, 0.2K

Avoid URL redirects:

https://www.google.com/pagead/drt/ui redirects to 
https://googleads.g.doubleclick.net/pagead/drt/si

Reduce JavaScript execution time:

/pagead/ads?client=…(googleads.g.doubleclick.net)
/pagead/ads?client=…(googleads.g.doubleclick.net)
…js/adsbygoogle.js(pagead2.googlesyndication.com)
…r20100101/osd.js(pagead2.googlesyndication.com)
…r20180604/show_ads_impl.js(pagead2.googlesyndication.com)
…activeview/osd_listener.js(tpc.googlesyndication.com)

etc., etc., etc...

I know that I can’t edit the code on their side. But maybe there is some way to defer Google Ads or do any other trick to reduce the harm of Google’s own services? Is there at least someone who has a 100/100 score on Google Page Speed (Mobile), having 2-3 Google Ads on a page?

Immigration answered 30/11, 2018 at 10:16 Comment(2)
I'm voting to close this question as off-topic because SEO questions are offtopic, as the tag states. Use webmasters.stackexchange.comMeagan
Can you please remind me what the ad tag looks like where you place the ad? What is the HTML snippet used to position an ad?Rhenium
H
3

I had some tests and a closer look at these issues recently. So have some solution and recommendation related to this.

The main goal is to minimise the impact on your site speed and move all the conversion and 3rd party scripts to lower priority load, for example, add them in the footer section not on the head as all these services suggest to do. You won't lose much to load these scripts with lower priority from a tracking and analytics perspective. Probably, you will increase a little bit possible that some of the conversion won't be tracked and will be missed on your reports but at the same time, you will improve the site speed for all users. An exception would be to keep Google Analytics or Google Tag Manager in the head as this could be higher priority and important from functionality and tracking perspective.

Another important and good practice is to review and remove all the tags where you don't have active campaigns and keep on the website only these tracking scripts what is important from a marketing and tracking perspective and what makes sense.

My recommended method to control all these 3rd party scripts is to use Google Tag Manager and manage all these tags thought it.

How to optimise site speed when using 3rd party scripts with Google Tag Manager:

  1. Prioritise all your script loading and order them by priorities

Use Google Tag Manager's page view trigger to fire tags when pages are loaded in web browsers. There are three trigger types that track page load events, and each type has slightly different criteria to determine when the trigger should fire a tag:

Page View: Fires immediately when the web browser begins to load a page. Use this option if you only need data generated from page impressions.

DOM Ready: Fires after the browser has finished constructing the full page in HTML and the Document Object Model (DOM) is ready to be parsed. Pageview-based tags that interact with the DOM to populate variables should use this trigger type to ensure that the correct values are available to Tag Manager.

Window Loaded: Fires after the page has fully loaded, including any embedded resources such as images and scripts.

To create a new page view trigger:

  1. Click Triggers and then New.
  2. Click Trigger Configuration and choose a page view trigger type.
  3. Optional, but recommended to improve performance: Specify conditions (usually a URL pattern) for pages where you expect a click to occur:

    • Under the heading "This trigger fires on", select "Some Events".
    • Under "Fire this trigger when an Event occurs and all of these conditions are true", add a filter to enable this trigger only on pages that require it, e.g. Click URL contains /path/to/promo.
  4. Save the trigger and publish.

Source: https://support.google.com/tagmanager/answer/7679319?hl=en

I recommended using Page View trigger only for the most important tags, for example, Google Analytics. For all other tags, you should use at least DOM Ready or more likely Page Loaded triggers. Using Page Loaded trigger will give the less impact on your site speed for all these 3rd party tags but you will increase the possibility that some of the conversions won't' be tracked if the users close Thank You page sooner then the tracking script is loaded.

Sometimes scripts like HotJar or similar heatmap scripts should be used with Page View script as well to increase accuracy for these analytics data.

If you add some chat or support tools on your website, then for these scripts should use the Page Loaded trigger as well.

  1. Review and update the scripts as necessary.

You should review, change or put on Pause the tags what you are not using or these 3rd party tools don't have any active campaigns.

Use Resource Hints: DNS Prefetch and/or Preconnect

Additionally, you should use these resources hints for all of your 3rd party resources what is loaded from another domain. As both are not supported for the same browsers, I would recommend using both of them.

In short, you should use these for all the domains what's mentioned under Reduce DNS Lookups.

The code what you should add on your head, should look like this:

<!-- Prefetch DNS for external assets -->
 <link rel="dns-prefetch" href="//fonts.googleapis.com">
 <link rel="dns-prefetch" href="//www.google-analytics.com">
 <link rel="dns-prefetch" href="//cdn.domain.com">

<!-- Preconnect for external assets -->
 <link rel="preconnect" href="//fonts.googleapis.com" crossorigin>
 <link rel="preconnect" href="//www.google-analytics.com" crossorigin>
 <link rel="preconnect" href="//cdn.domain.com" crossorigin>
Holley answered 2/12, 2018 at 22:17 Comment(0)
R
-1

I especially notice fonts.googleapis.com on many sites which hang the page load for up to 10+ seconds. It's very annoying because my uBlock Origin ad blocker doesn't block that.

Some things you can do is to host the content on your own servers (fonts, JQuery), but then people won't have them cached for frequently accessed libraries. (Probably everyone has the latest version of JQuery in their cache already from a CDN because all web sites use it.) You could try to host the ad scripts, but Google probably frequently changes them, or includes a hash for each unique user which would render that impossible. If they are not unique to each user, you may need to refresh them frequently in the background, maybe every hour, or day. Unsure.

Also, place the <script> tags at the bottom of the page, even after </body>, but before </html>. This will load the scripts last and load the ads last.

Another thing you can do is place a JQuery $(document).ready() {...} function to insert the ad <script> tags and <iframe> (?) tags in the proper locations after the document has loaded. Then they won't count against your page speed load times. Use a <div class="ad"></div> placeholder.

Rhenium answered 2/12, 2018 at 22:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.