Support » Plugin: Local Google Analytics for Wordpress - caches external requests » Need some changes for webmastertools

  • KaiSchultka

    (@andrenalin)


    Hey,

    plugin is working fine, if you want to use it also for webmastertools you need to change some lines in output.class.php

    thanks for this small plugin

    // Génère le code Google Analytics
    		public static function googleCode(array $options) {
    
    			// Ecriture des options
    			$ret  = "\n" ;
    			$ret .= '<!-- Simple Google Analytics Begin -->' . "\n" ;
    			$ret .= '<script type="text/javascript">' . "\n" ;
    			/*$ret .= 'var _gaq = [' ;
    			foreach ($options as $key => $value) {
    				$ret .= is_null($value) ? '[\'' . $key . '\']' : '[\'' . $key . '\',\'' . $value . '\']' ;
    				$ret .= ',' ;
    			}
    			$ret  = rtrim($ret, ',') ;
    			$ret .= '];' ;*/
    
    //changed lines
    			$ret .= 'var _gaq = _gaq || []; _gaq.push(' ;
    			foreach ($options as $key => $value) {
    				$ret .= is_null($value) ? ' _gaq.push([\'' . $key . '\']' : '[\'' . $key . '\',\'' . $value . '\']' ;
    				$ret .= ');' ;
    			}
    			$ret  = rtrim($ret, ');') ;
    			$ret .= ');' ;
    //changes ends
    			// Code Google
    			$ret .= '(function() {' . "\n" ;
    			$ret .= 'var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n" ;
    			$ret .= 'ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n" ;
    			$ret .= 'var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n" ;
    			$ret .= '})();' . "\n" ;
    			$ret .= '</script>' ;
    			$ret .= "\n" . '<!-- Simple Google Analytics End -->' ;
    			$ret .= "\n" ;
    
    			return $ret ;
    		}

    http://ww.wp.xz.cn/extend/plugins/simple-google-analytics/

  • The topic ‘Need some changes for webmastertools’ is closed to new replies.