“MediaWiki添加Google Analysis”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
→‎ops
 
(未显示同一用户的12个中间版本)
第1行: 第1行:
 +
 +
=ops=
 +
 +
* 下载 下载  我选择 比我的mv版本高一点点的版本  [https://www.mediawiki.org/wiki/Special:ExtensionDistributor/googleAnalytics Download] and place the file(s) in a directory called googleAnalytics in your extensions/ folder.
 +
* Add the following code at the bottom of your LocalSettings.php:
 +
<pre>
 +
 +
require_once "$IP/extensions/googleAnalytics/googleAnalytics.php";
 +
// Replace xxxxxxx-x with YOUR GoogleAnalytics UA number
 +
$wgGoogleAnalyticsAccount = 'UA-18180817-2';
 +
 +
// Optional configuration (for defaults see googleAnalytics.php)
 +
 +
// Add HTML code for any additional web analytics (can be used alone or with $wgGoogleAnalyticsAccount)
 +
$wgGoogleAnalyticsOtherCode = '<script type="text/javascript" src="https://analytics.example.com/tracking.js"></script>';
 +
 +
// Store full IP address in Google Universal Analytics (see https://support.google.com/analytics/answer/2763052?hl=en for details)
 +
$wgGoogleAnalyticsAnonymizeIP = true;
 +
 +
// Array with NUMERIC namespace IDs where web analytics code should NOT be included.
 +
$wgGoogleAnalyticsIgnoreNsIDs = [
 +
    500
 +
    ];
 +
 +
// Array with page names (see magic word {{FULLPAGENAME}}) where web analytics code should NOT be included.
 +
$wgGoogleAnalyticsIgnorePages = [
 +
    'PageName',
 +
    'NamespaceName:PageName'
 +
    ];
 +
   
 +
// Array with special pages where web analytics code should NOT be included.
 +
$wgGoogleAnalyticsIgnoreSpecials = [
 +
    'Userlogin',
 +
    'Userlogout',
 +
    'Preferences',
 +
    'ChangePassword',
 +
    'OATH'
 +
    ];
 +
   
 +
// Use 'noanalytics' permission to exclude specific user groups from web analytics, e.g.
 +
$wgGroupPermissions['sysop']['noanalytics'] = true;
 +
$wgGroupPermissions['bot']['noanalytics'] = true;
 +
 +
// To exclude all logged in users give 'noanalytics' permission to 'user' group, i.e.
 +
$wgGroupPermissions['user']['noanalytics'] = true;
 +
 +
 +
 +
vim  extensions/googleAnalytics/googleAnalytics.php
 +
 +
$wgGoogleAnalyticsAccount = "UA-18180817-2";
 +
$wgGoogleAnalyticsAddASAC = false;
 +
$wgGoogleAnalyticsIgnoreSysops = true;
 +
$wgGoogleAnalyticsIgnoreBots = true;
 +
 +
 +
 +
补充信息
 +
 +
#查看到 这个要不要加上
 +
 +
http://www.linuxren.net (UA-18180817-1)
 +
https://wiki.linuxchina.net/ (UA-18180817-2)
 +
</pre>
 +
 +
 +
 +
https://analytics.google.com/analytics/web/#/realtime/
 +
 +
=wordpress=
 +
 +
[https://cn.hostgator.com/news/product/hosting/353.html 轻松为你的WordPress网站添加谷歌分析]
 +
 +
 +
[https://themeforwp.net/archives/wordpress-install-google-analytics-and-search-console/ WordPress配置谷歌分析(Google Analytics)和Search Console(GSC)教程]
  
 
=see also=
 
=see also=
 +
[https://www.dadclab.com/archives/1991.jiecao/comment-page-1  MediaWiki添加Google Analysis统计代码方法 ]
 +
 +
https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration
 +
 
[http://www.webkaka.com/blog/archives/Google-Analytics-cnzz-51la.html Google分析、cnzz、51la,哪个统计更准]
 
[http://www.webkaka.com/blog/archives/Google-Analytics-cnzz-51la.html Google分析、cnzz、51la,哪个统计更准]
  
  
 
[[category:ops]]  [[category:wiki]]
 
[[category:ops]]  [[category:wiki]]

2021年9月3日 (五) 13:00的最新版本

ops

  • 下载 下载 我选择 比我的mv版本高一点点的版本 Download and place the file(s) in a directory called googleAnalytics in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:

require_once "$IP/extensions/googleAnalytics/googleAnalytics.php";
// Replace xxxxxxx-x with YOUR GoogleAnalytics UA number
$wgGoogleAnalyticsAccount = 'UA-18180817-2'; 

// Optional configuration (for defaults see googleAnalytics.php)

// Add HTML code for any additional web analytics (can be used alone or with $wgGoogleAnalyticsAccount)
$wgGoogleAnalyticsOtherCode = '<script type="text/javascript" src="https://analytics.example.com/tracking.js"></script>';

// Store full IP address in Google Universal Analytics (see https://support.google.com/analytics/answer/2763052?hl=en for details)
$wgGoogleAnalyticsAnonymizeIP = true; 

// Array with NUMERIC namespace IDs where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreNsIDs = [
    500
    ];

// Array with page names (see magic word {{FULLPAGENAME}}) where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnorePages = [
    'PageName',
    'NamespaceName:PageName'
    ];
    
// Array with special pages where web analytics code should NOT be included.
$wgGoogleAnalyticsIgnoreSpecials = [
    'Userlogin',
    'Userlogout',
    'Preferences',
    'ChangePassword',
    'OATH'
    ];
    
// Use 'noanalytics' permission to exclude specific user groups from web analytics, e.g.
$wgGroupPermissions['sysop']['noanalytics'] = true;
$wgGroupPermissions['bot']['noanalytics'] = true;

// To exclude all logged in users give 'noanalytics' permission to 'user' group, i.e.
$wgGroupPermissions['user']['noanalytics'] = true;



 vim  extensions/googleAnalytics/googleAnalytics.php 
 
 $wgGoogleAnalyticsAccount = "UA-18180817-2";
$wgGoogleAnalyticsAddASAC = false;
$wgGoogleAnalyticsIgnoreSysops = true;
$wgGoogleAnalyticsIgnoreBots = true;



补充信息 

#查看到 这个要不要加上 

http://www.linuxren.net (UA-18180817-1)
https://wiki.linuxchina.net/ (UA-18180817-2)


https://analytics.google.com/analytics/web/#/realtime/

wordpress

轻松为你的WordPress网站添加谷歌分析


WordPress配置谷歌分析(Google Analytics)和Search Console(GSC)教程

see also

MediaWiki添加Google Analysis统计代码方法

https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration

Google分析、cnzz、51la,哪个统计更准