Forum Moderators: martinibuster
My purpose is to be able to place ads only on pages which meet certain conditions. I know how to test for this with JavaScript; I don't know if I can include the AdSence code within the JavaScript code.
I could post about this in the Webmaster World JavaScript forum but I am afraid to display my AdSence code to ask for help. So I'm hoping that someone here is familiar with JavaScript.
Thanks, Peter
if (condition = true)
{
AdSense code goes here
}
function blockError(){ return true; }
window.onerror = blockError;
</script>
<script type="text/javascript" src="js from googlesyndication"></script>
You have to add that blockError function because without your AdSense code (in the case when you are not showing the ad on specific page) it will generate an error for google variables.
Make sure you ask the authorities before implementing this code.