ewwink

Detect Adblock with Google analytics

Jun 4th, 2016
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ###############################################################
  2. # pastikan kode Google Analytics.js sudah ada di blog
  3. # lalu masukan kode blok <script>...</script> dibawah sebelum </body>
  4. # lihat laporannya: Real Time > Event > Last 30 minutes
  5. # atau: Waktu Nyata > Peristiwa > 30 Menit Terakhir
  6. # salam: ewwink
  7. ###############################################################
  8. <script>
  9. setTimeout(function() {
  10.   if(typeof adsbygoogle !== "undefined") {
  11.     window.addEventListener('load', function() {
  12.       if(typeof ga !== "undefined") {
  13.         if(typeof adsbygoogle.loaded === "undefined") {
  14.           ga('send', 'event', 'AdSense', 'Bad, Ads blocked', {
  15.             "nonInteraction": 1
  16.           });
  17.         }
  18.         else {
  19.           ga('send', 'event', 'AdSense', 'Goood, Ads not blocked', {
  20.             "nonInteraction": 1
  21.           });
  22.         }
  23.       }
  24.     }, false);
  25.   }
  26. }, 500);
  27. </script>
Add Comment
Please, Sign In to add comment