html 脚本zur Analyze der Ad Blocker-Nutzung auf网站。 Mehr dazu:http://www.121watt.de/analyse-optimierung

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 脚本zur Analyze der Ad Blocker-Nutzung auf网站。 Mehr dazu:http://www.121watt.de/analyse-optimierung相关的知识,希望对你有一定的参考价值。

<div class="afs_ads">&nbsp;</div>
<script>
  function testAdBlock() {
    setTimeout(function() {
      if( !document.getElementsByClassName ) return;

      var ads = document.getElementsByClassName('afs_ads'),
          ad  = ads[ads.length - 1];

      if(!ad || ad.innerHTML.length == 0 || ad.clientHeight === 0) {
        if ( typeof ga !== 'undefined' ) {
          ga('send', 'event', 'ads', 'activated', 'ad blocker', { nonInteraction: true });
        } else if ( typeof _gat !== 'undefined' && typeof pageTracker !== 'undefined' ) {
          pageTracker._trackEvent('ads', 'activated', 'ad blocker', undefined, true);
        } else if ( typeof _gaq !== 'undefined' ) {
          _gaq.push(['_trackEvent', 'ads', 'activated', 'ad blocker', undefined, true]);
        }
      } else {
        if ( typeof ga !== 'undefined' ) {
          ga('send', 'event', 'ads', 'not active', 'ad blocker', { nonInteraction: true });
        } else if ( typeof _gat !== 'undefined' && typeof pageTracker !== 'undefined' ) {
          pageTracker._trackEvent('ads', 'not active', 'ad blocker', undefined, true);
        } else if ( typeof _gaq !== 'undefined' ) {
          _gaq.push(['_trackEvent', 'ads', 'not active', 'ad blocker', undefined, true]);
        }
      }
    }, 2000);
  }

  if ( document.cookie.indexOf('session') <= 0 ) {
    if(window.addEventListener) {
      window.addEventListener('load', testAdBlock, false);
    } else {
      window.attachEvent('onload', testAdBlock);
    }
  }

  var d = new Date();
  d.setTime(d.getTime()+1800000);
  var expires = 'expires='+d.toGMTString();
  document.cookie = 'session=1; '+expires+'; path=/';
</script>

以上是关于html 脚本zur Analyze der Ad Blocker-Nutzung auf网站。 Mehr dazu:http://www.121watt.de/analyse-optimierung的主要内容,如果未能解决你的问题,请参考以下文章

php Wordpress Plugin-Code zur Ausgabe von Infos zu Autor,Kategorie等als Variablen imdataLayerfür

itop AD 自动导入脚本 webservices/AD_import_accounts.php

itop AD LDAPUser profile同步,附官方脚本

sh 用于解析Nginx访问日志的Bash脚本:https://sysadmins.co.za/bash-script-to-parse-and-analyze-nginx-access-logs/

iOS性能调优之Analyze静态分析

AD实用组策略/脚本集合 (重大更新20160627)