How to stop Google ads from slowing down my website? - html

I am using the Google Chrome profiler to run a speed audit on my site.
It is complaining about a file show_ads_impl.js
I am not 100% sure where that is coming from? I took out AdSense from my page and now just have the Google AdWords retargeting being set. But I added the async tag to that script.
This is the page I am working on: here
And here is the screenshot of the profiler's complaint:
Also, the profiler suggests to use
<link rel="preload">
But where do I add that?

If you're noticing that Google ads are slowing down your website, there are a few things you can do to help speed things up. First, make sure that you're using asynchronous loading for your ads. This means that the ads will load in the background while the rest of your website loads. You can also try using a cache plugin to cache your ads. This way, they'll be loaded from the cache instead of from the server every time a page is loaded. Finally, you can try using a content delivery network (CDN) to deliver your ads. A CDN can help to speed up the delivery of your ads by distributing them across multiple servers.

You would add the link rel... to the head section of the page. One trick I use is to load the page, then the scripts on the page. I'm not sure where you currently have the scripts linked in your markup, but try linking them down at the bottom, just above the Body closing tag. The whole page loads, then the ads load - same time total, but the user won't notice.
...
...
<script type='text/javascript' src='googlyads.com/ads.js'>
</body>

Related

How do I fix multiple redirects to my mobile site on Blogger?

One of the numerous suggestions made by Google Page Speed Insights regarding my slow as yuck website is:
Avoid multiple redirects. Redirects introduce additional delays before
the page can be loaded. Learn more. URL Time Spent (Initial:
http://okc-craigslist.blogspot.com/) 0 ms
/?m=1(okc-craigslist.blogspot.com) 630 ms
/?m=1(okc-craigslist.blogspot.com) 180 ms
Can someone tell me what this means exactly? I don't know why I would be redirecting twice to the mobile version of my website. How do I fix this?
Help!
If you mouse over the two links in the PageSpeed output, you can see that the first starts with http://, and the second https://. The first redirect changes the query string, and the second the scheme.
Ideally the first redirect would send you to both HTTPS and mobile version of the site, but that might not be possible for you to control.
Perhaps Blogger can turn on HSTS? That will teach the user's browser to apply the http→https redirect to the entire site.
To Avoid multiple page redirection for Following Steps :
Go to "Edit HTML" of your blog/blogger.com or website.
Add below code just after tag of your blog:
<script type='text/javascript'>//<![CDATA[
var curl = window.location.href;if (curl.indexOf('m=1') != -1) {curl = curl.replace('m=1', 'm=0');window.location.href = curl;}
//]]></script>
and Save it .
it will works fine
here is Demo website that it works fine on blogger

is it important to put the google tag manager codes in website head tag

i have the google tag manager codes:
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5K4WCTR');</script>
<!-- End Google Tag Manager -->
google recommendation is :
Copy the code below and paste it onto every page of your website.
Paste this code as high in the of the page as possible.
so my concern is can i put the codes in website footer just before closing body tag. does putting it in head affect the google page speed score and what are the cons if i do so.
share your knowledge and experience please.
Experience is anecdotal so take this with a grain of salt.
We A/B tested GTM positions in a major (> 17m sessions/month) website and found no real difference in the outcome between positioning it in the header or footer, which we found surprising, since we had expected data loss (that is the reason Google suggests to put the code as high as possible).
Moving GTM did not affect overall loading time (since the amount of assets loaded was the same), but it did speed up the time before the users could interact with the page.
Moving GTM helped us to save a few events; there was some data that we had to take from existing markup or variables on the page. Before we had to send an event at DOM ready, after the move we could send the same data as custom dimensions with the pageview (this is a workaround, however, ideally all necessary data would be pushed on the datalayer).
This does not mean that I think GTM can be placed safely at the page bottom in all cases; I assume the more stuff you load in your page, the more likely it is that a user cancels loading before GTM is executed. But it does mean I do not think an absolute prohibition of having the code in the footer makes sense, the only way to know for sure is to test both.
Google recommends putting it immediately inside of the head and not inside of any other html element. Why? It’s better for tracking all around. The higher up in the page the snippet is, the faster it is loaded. In the older version of Google Tag Manager, it was recommended to place the snippet in the body tag, but this would potentially miss tracking users who left your page before the body tag loaded.
This has become even more important with the release of Google’s new A/B testing tool, Optimize. Whether you’re running a redirect test or and A/B experiment, having the snippet load faster ensures that Optimize will load the correct version of the page that your user is supposed to see, as soon as possible.

Google Analytics - Multiple pages and single header

My webpage is compose from more "pages". For example:
www.webpage.com/home.php
www.webpage.com/registration.php
www.webpage.com/contacts.php
...etc
But all my pages have the same , because I include the same head in all of my pages.
My question so far:
1.) Is good to place the google analytics script in my head?
2.) If someone goes from www.webpage.com/home.php to www.webpage.com/registration.php it will count it as two visit of my page?
Thx
its okay to place google analytics script in your head. google analytics is java script and is run only after the page is loaded into your browser. So each page will be individually recognized.
Yes. Google actually recommends to put the code in the header
Paste your snippet (unaltered, in its entirety) into every web page
you want to track. Paste it immediately before the closing
tag.
One of the reasons is that GA has a report on page timings. The timer is started when the tracking code is loaded, so if you insert the code later in the page the timing reports might be off.
If you have the tracking code in all pages and GA can set cookies properly then the two calls to the pages will be tracked as two pageviews, but only one session/visit.

Ad couponDropDown

I've got a problem concerning famous on-site ads malware, specifically Ad couponDropDown.
I'm aware that usually these ads are created via malware on computer, or as browser Add-on. However, my hard drive and my firefox, both are clean, but ads is still shown on particular website that I created a long time ago.
It is inserted between two divs as html tag with random generating class.
Site is running on wordpress with iThemes security (formerly better security) - with latest update and none high-risks issues.
As I downloaded and updated plugin the ad itself disappeared, but left blank container and "ads by coupon | close" link.
For now I hid center tag via css.
I appreciate any response.
Link to site (it's in slovenian):
http://www.grasshopper.si/
I had the same problem. Suddenly, a site I manage was full of banners from "couponDropDown". My problem was not about a local virus in my computer too.
Here is what i found, and how I solved it:
As I mentioned before, I manage a Moodle site where other users managed courses.
In two courses, managed by the same person, the couponDropDown nightmare appeared. But not in others. The problem was restricted to a certain courses from a certain person.
Obviously, it was content loaded by that person, but it was not obvious where it was.
After looking for a while, in the WYSIWYG editor, looking at the HTML source, some scripts tags having the following structure were found:
<p>Some HTML over here</p><script src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=10368"></script>
All over the course, that script was found. This caused some iframes to be created, and some content from http://advertising-support.com/ to be loaded.
Finally, I just thought that the computer of the person managing those two courses was infected AND (here is the important thing) introducing that code in the editor without being noticed, and loading that script in the site. Those scripts finally loaded tons of banners and the like. Really smart.
SOLUTION: went all over those two courses content looking for the script loading from akamaihd.net.
I guess you may have had the same issue. Maybe you are using a WYSIWYG editor in your backend and that script is attached to the rest of the content without you noticing it.
You may analize your database looking for that script (and as of November 5 2014, it is still there :)
If you are curious, just C&P this code in a html file and load with your local server. With a developer tool, just surf the newly HTML introduced. You will se some iframes, objects loading falsh, some net traffic, and the like but no actual content is showed:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>couponDropDown test</title>
</head>
<body>
<p>Some HTML over here</p>
<script src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=10368"></script>
</body>
As an example, I think it is useful. And as far as I can say, it is safe! Hope it helps!

How do I configure optimal cache policy for index.html page in my site?

I have a web site with an index.html homepage that is updated from time to time. We sometimes add offers for our clients, special messages and so on, which have to be visible by next day for everyone.
If index.html is cached by browsers, many users will not notice that anything has changed, unless they explicitly refresh the contents of the page...
Which is the best way to be sure that 100% visitors have an up-to-date index.html page, without compromising cache performance?
My best answer would be to skip out on updating the index.html each time and go with a server-side programming language, like PHP. You can then set the headers for the page to not cache, and you can also set up an admin page that you can use to change the content. Or you could go with a browser-side script with JavaScript using AJAX. Then the page has an ability to update before the next loading of the site.