Tests of me had shown, that the CTR is time critical with the load time of the ads.
When You load first the javasctipt,
So think also on all what can be criticall to CTR
|that would only impact the first page |
True. Depends on how much you're willing to let the time-lag impact on your first view. I'd rather have my one-view-bouncers view and click on my ad to leave the site than going back to SERPs.
Why not simply put it in an include file as I do?
Using the Adsense code in a an external file and calling in on individual pages is good webmastering.
Done this way, the Adsense file gets cached, speeding up your load time. I put the tag early in the mark-up, then float it with CSS into position on about 150 webpages, using 6 different versions. But it is the slowest component of my page since it comes from a remote server.
|Why not simply put it in an include file as I do? |
That's exactly what we're recommending.
|Depends on how much you're willing to let the time-lag impact on your first view. |
When you include the code at the beginning of the page it's pre-loaded so there's no perceived delay once the page is displayed except the time it takes AdSense itself to execute which as keyplyr noted it already slow.
I don't think it's worth the effort myself because there's not enough lines of code in the AdSense part we install to really impact page load and you would be better off implementing gzip page compression if you don't already have it to improve load speed.
No need use document.write, it's in an include file.
Wrap it in a function call like "func AdSenseSkyScraper()" and then just call the function later in the code.
No, what I've done for over 3 years is to place the Adsense code(s) in an html file(s) all by itself, calling it to the page with PHP includes since all my HTML pages are served through PHP and gzip'd anyway.
Hah! That I never thought of this :) Guess this might open up some possiblities with regard to lazy / asynchronous loading as well.
1. Speed for the first page view is critical, which favors on-page JS.
2. The AdSense code is fairly minimalist, very little would be gained from making it external. The code already references an external file anyway (show_ads.js) where most of the JS is stored.
3. A server-side include is much faster than an external JS file.
This is a non-issue.
Like Keyplyr, I use php includes for the adsense code. Being a server side include, the page is rendered (with adsense code) completely before the browser sees it.
No delay on the browser (except for the external show_ads.js), only some CPU cycles on the server.
All my htm and js files are GunZip compressed on the server.
The CSS is optimized to 2 kb and in the head section of the page.
So one file load less, rendering can start faster.
My typicall page size is 17 kb uncompressed, 5 kb compressed.
Since I use the same adsense code among all of my pages and I get huge traffic, I guess it's better using the js file, since it's downloaded once and cached. I use caching and gzip compression for my js files. I believe it's a good approach rather and more over I don't see any advantages over this approach vs. including it on the server side.
Including it in JS
1. Cached, Gzipped
2. Served only once to the visitors
1. Slow for the first time
Including it on server side
1. This approach is clearly not against TOS
1. Served for every page making the size of the page large
2. Including the file on the server side makes an additional cpu cycle
Am i missing something here?
3. a file system cycle as the included file has to come from disk (could be cached from memory if the server is properly configured and doesn't page fault due to heavy load)
incrediBILL, keyplyr: I was responding to the technique described in the initial post, which seems to be a little flaky and of only microscopic benefit, not to the PHP alternatives which are quite sensible and should be transparent to Google.
As others have noted, a server-side include will work best. Forget about using js.
Simply place your Google code into an include file (i.e. .html, .txt, .php, .asp) and use the appropriate code within your HTML.
|PHP: <?php include("google-stuff.txt/php/html"); ?> |
|ASP: <!--#include file="google-stuff.txt/asp/html"--> |
While I'm convinced this is an oversight in the current implementation at GWT, their Site Speed Tool currently seems to suggest the idea of moving the Adsense code to your server:
Minimize DNS lookups
The domains of the following URLs only serve one resource each. If possible, avoid the extra DNS lookups by serving these resources from existing domains:
I saw too much experiments with Adsense code is against TOS & will rather harm you than benefit you! Eventually the account might be suspended one day. Better to do other research how to bring more traffic and let the Adsense code remain as it is without any disturbance. Money will start flowing in by itself in course of time. For quick traffic what tech. are you following folks?
Everything everyone said before me is totally nuts. If your using a CMS its already loading adsense code from the database. show_ads.js cannot be loaded from your server because you never know when adsense is going to change it. And anyway why the hell would you want to do that when adsense does not permit change to code?
Also has anyone thought of the fact that the browser caches show_ads.js even when loading from google's servers? Surely its not fetching it everytime its called on the multitude of pages on the web! I just checked and on subsequent access google sends a 304 not modified header and the browser simply loads the file from cache.
|I just checked and on subsequent access google sends a 304 not modified header and the browser simply loads the file from cache. |
Don't they expire it quickly though?
max-age=86400, not too quick