0

Best way to embed adsense code

asked 2012-01-27 23:09:07 +0800

zerostress gravatar image zerostress
9

Hi,
can someone explain the correct way to insert adsense js code in zul pages in order to load adsense fast?

i use this code
<html style="margin:0 0 5px 0;padding:0;"><![CDATA[
<script type="text/javascript"><!--
google_ad_client =.......;
/* middle-listings */
google_ad_slot =.......;
google_ad_width =.......;
google_ad_height=.......;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

]]></html>
In Firefox and Explorer adsense are diplayed but loading time is slow; in Chrome sometimes no ads are displayed....
Thanks in advance

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-01-28 01:55:40 +0800

RichardL gravatar image RichardL
768 4

Hi zerostress,
The script doesn't need to be in an Html component - Script is a component, itself.

link publish delete flag offensive edit

answered 2012-01-28 09:38:26 +0800

zerostress gravatar image zerostress
9

Hi RichardL,
if i use the zk component Script, ads aren't displayed; the only way i've found to work correctly is using html component...
Thanks for your reply

link publish delete flag offensive edit

answered 2012-01-28 13:11:17 +0800

RichardL gravatar image RichardL
768 4

updated 2012-01-28 13:11:51 +0800

Could you show the rest of the zul file? Thanks

link publish delete flag offensive edit

answered 2012-01-29 13:31:24 +0800

zerostress gravatar image zerostress
9

the problem is easy to reproduce...The real problem is Chrome: if you repeat page refreshing (3-4 times), the ads are not visible.....

I use Chrome on Ubuntu.

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal">
New Content Here!
<html style="margin:0;padding:0;"><![CDATA[
<script type="text/javascript"><!--
google_ad_client = ...;
/* listings */
google_ad_slot = ...;
google_ad_width = ...;
google_ad_height = ...;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br/>
<br/>

]]></html>
</window>
</zk>


Thanks

link publish delete flag offensive edit

answered 2012-01-30 01:39:56 +0800

RichardL gravatar image RichardL
768 4

I don't know if this will work because I don't use adsense, but you could give it a try:

<zk xmlns:c="client">
 <script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"/>
    <window title="new page title" border="normal">
New Content Here!
        <script type="text/javascript">
    zk.afterMount(function() {
               google_ad_client = ...;
/* listings */
google_ad_slot = ...;
google_ad_width = ...;
google_ad_height = ...;      
});
        </script>
    </window>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-27 23:09:07 +0800

Seen: 245 times

Last updated: Jan 30 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More