2014-11-24 7 views
0

그래서 사람들이 내 div 태그에서 내 광고를 클릭 할 때 이벤트가 발생하도록 마우스를 놓으려고합니다. 왜? 나는 무효 클릭으로 인해 애드 센스 계정이 금지 된 친구가 있기 때문에 내가 원하는 것은 IP를 기록하고 광고를 클릭하면 광고가 다시 게재되기 전에 약 5 일 동안 모든 광고가 사라지므로 계속해서 광고를 클릭 할 수 없으므로 광고 계정이 금지됩니다. . 내가 테스트했던 어떤div를 포함하는 div에 마우스 아래로

이 사람이 텍스트를 클릭하면 작동이

<script> 
function mouseDown() { 
    alert("Yes"); 
} 
</script> 

<p id="myP" onmousedown="mouseDown()"> 
Does this work? 
</p> 

, 그리고 메시지 "예"를 보여줍니다. 하지만이없이

<div class="myAds" onmousedown="mouseDown()"> 
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> 
<ins class="adsbygoogle" 
    style="display:inline-block;width:336px;height:280px" 
    data-ad-client="ca-pub-2948xxxxxxxxx2" 
    data-ad-slot="6735xxxx36"></ins> 
<script> 
(adsbygoogle = window.adsbygoogle || []).push({}); 
</script> 
</div> 

그것은 작동하지 않습니다 내부 광고, 그것은하지 모든 광고에 해협, 이동을 넣을 때 어떤 경고

사람이 문제, 또는 주변에 다른 작업에 도움을 줄 수?

+0

mousedown 이벤트가 작동하지 않는 이유는 광고 태그가 동일한 문제를 일으키는 iframe은 [여기] (http://stackoverflow.com/questions/3690812/capture-click-on-div-surrounding-an-iframe)에 설명되어 있습니다. 그러면 왜 문제가 발생하는지 자세히 설명합니다. 해당 링크에서 제공되는 솔루션은 사용자 시나리오에서 작동하지 않을 수도 있지만 시작일 것입니다. –

답변

0

은 내가 할 필요가 기본적으로 여기에서 https://github.com/DarkN3ss61/Adsense-Blocker 이상 이것에 대한 GitHub의 프로젝트를 만든이

var isOverGoogleAd = false; 

var ad = /adsbygoogle/; 

$(document).ready(function() 
{ 
    $('ins').live('mouseover', function() { 
     if(ad.test($(this).attr('class'))){ 
      isOverGoogleAd = true; 
     } 
    }); 
    $('ins').live('mouseout', function() { 
     if(ad.test($(this).attr('class'))){ 
      isOverGoogleAd = false; 
     } 
    }); 
}); 

$(window).blur(function(e){ 
    if(isOverGoogleAd){ 
     $.ajax({ 
      type: "post", 
      url: "AdsenseBlocker/recorder.php", 
      data: { 
       adUrl: window.location.href 
       } 
     }); 
    } 
}); 

그래서 당신은 참 또는 따라 거짓 부울로 설정하는 마우스 오버 및 마우스 아웃 기능을 가지고있다 날씨에 마우스가 광고 안에 있고 iFrame의 광고에 초점이 맞춰지기 때문에 광고를 클릭하면 바깥 쪽 웹 페이지가 blured가됩니다. 따라서 isOverGoogleAd가 true이고 외부 광고 페이지가 blured가되면 if 광고를 클릭했습니다.

관련 문제