Forum Moderators: martinibuster

Message Too Old, No Replies

Prevent Adsense from displaying on secure pages

         

camaroboy

3:56 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I am trying to run Google Adsense on my website. This is an ecommerce website and has both secure and unsecure pages. As we all know, a pop-up comes on when there is anything unsecure on a secure page (like Google Adsense) and this pop-up is known to hurt conversions.

Does anyone know a script or code I can use to disable Adsense from showing on my secure (https) pages?

encyclo

4:01 pm on Jul 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld camaroboy. You can use a conditional include so as not to load the AdSense code-block when on a secure page. What server-side scripting (if any) are you using?

camaroboy

4:15 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



My website is hosted by Monster Commerce and they do not allow any server-side scripting because it violates some credit card policies...or say they say. I guess they say it is unsafe for the customers of the sites they host. They also tell me I cant do any php (which I think is server-side scripting).

I do have some 2 sets of javascript on my website; 1 to preload images on the top part of the page and another javascript code to load my RSS feed to the page.

I think my only way to do it may to be to write a javascript code (which I have so far been unsucessful at doing). Is that possible?

AussieWebmaster

5:47 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



You should be able to write a javascript that stops the loading of the adsense code if the page begins with https or some such..

AussieWebmaster

5:47 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



or to just comment it out!

camaroboy

5:52 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I know that I "should be able to write javascript" that will do this...the problem is I dont know how! Does anyone want to take a crack at actually giving me some script that will work?

I lack in the javascript area...please help!

camaroboy

5:56 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



BTW...I found some script on another forum when I was searching for how to do this. The script is as follows:

{if $current_location == $http_location}
Google AdSense Goes Here
{/if}

The problem is I cannot get that to work with Adsense because the Adsense code itself has 2 different javascript codes in it.

Will the above script work? Am I just putting it in wrong? Or do I need a different script all together?

AussieWebmaster

7:02 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



You need to actually put the code inside it not the quoted text

camaroboy

8:13 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I've tried using the following code which doesnt work:

<script type="text/javascript">
{if $current_location == $http_location}
<!--
google_ad_client = "pub-#*$!#*$!#*$!x";
google_alternate_ad_url = "http://www.example.com/";
google_ad_width = xx;
google_ad_height = xx;
google_ad_format = "xx";
google_ad_type = "xx";
//2007-07-10: Image xx
google_ad_channel = "#*$!#*$!xx";
google_color_border = "color";
google_color_bg = "color";
google_color_link = "color";
google_color_text = "color";
google_color_url = "color";
google_ui_features = "rc:0";
//-->
{/if}
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Is the "if statement" in the wrong place?