Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

[Tutorial] Speed Up Adsense Page Loading

Asked Modified Viewed 3,337 times
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
  • Started this discussions
asked
Senior Member

As a webmaster of many years I understand fully that using advertisement such as google adsense can actually slow down websites with an additional couple of seconds in loading time.

To a lot of users this is a big deal and can actually harm your search ratings.

With this simple trick you can ensure that all other content within your website will load first and fetch the advertisement last effectively speeding up your websites loading time.

This will also work with other advertisements, but as an example we'll use Google Adsense.

Alright, as I'm using my own advertisement code at the moment you'll need to edit to meet your parameters.

------------------------------------

In Admin Panel ->System Admin -> Panels

Create a new panel and have it display where you want it "LEFT, UPPER, LOWER, RIGHT", it does not matter.

Panel Name
- Set to anything

Panel Content:

echo '<div id="fusion_ad"></div>';

add_to_footer('<div id="fusion_ad_footer" class="clear" style="display: none; padding-bottom: 10px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-7277300469198625";
/* 300x250, created 11/18/09 */
google_ad_slot = "8794678125";
google_ad_width = 296;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>

<script type="text/javascript">
         window.onload = function() {
            document.getElementById(\'fusion_ad\').appendChild(document.getElementById(\'fusion_ad_footer\'));
            document.getElementById(\'fusion_ad_footer\').style.display = \'\';
         }
</script>');


You'll need to change the following, or remove it entirely and add your own source.

<script type="text/javascript"><!--
google_ad_client = "ca-pub-7277300469198625";
/* 300x250, created 11/18/09 */
google_ad_slot = "8794678125";
google_ad_width = 296;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


You must be using PHPFusion 7.02 + in order for the add_to_footer function to work as it doesn't for earlier versions.

Save the panel and enable.

Your advertisement should load last on the web page after all other content is loaded.

A live working example can be found here.
Edited by NetriX on 13-10-2012 22:33,
0 replies

4 posts

H
HaYaLeT
H
  • Senior Member, joined since
  • Contributed 262 posts on the community forums.
  • Started 28 threads in the forums
answered
Senior Member

Thank you. Helpful..
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Good solution.
0 replies
A
Ankur
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums
answered
Veteran Member

Thats a nice solution David... :)

I always feel irritating when this adsense use to keep loading the page of my website and it looks bad when the loading bar keep loading...

This does the trick... ;)
0 replies
N
NetriX
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
  • Started this discussions
answered
Senior Member

Quote

Ankur wrote:

Thats a nice solution David... :)

I always feel irritating when this adsense use to keep loading the page of my website and it looks bad when the loading bar keep loading...

This does the trick... ;)

The name's Brandon, but thanks for the feedback and glad it helped. B)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 4 members

4 participants

N
N
NetriX 10
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Mon-Thurs. Send me a PM if urgent.
  • Senior Member, joined since
  • Contributed 566 posts on the community forums.
  • Started 93 threads in the forums
  • Started this discussions
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
H
H
  • Senior Member, joined since
  • Contributed 262 posts on the community forums.
  • Started 28 threads in the forums
A
A
Ankur 10
Hi! Its me, Ankur Thakur! smile
  • Veteran Member, joined since
  • Contributed 1,277 posts on the community forums.
  • Started 60 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet