Extension:Analytics
リリースの状態: 安定 |
|
|---|---|
| 実装 | 特別ページ |
| 説明 | Traffic and edit analytics for the entire wiki, as well as specific categories and pages |
| 作者 | Sophivorusトーク |
| 最新バージョン | 1.2 |
| MediaWiki | 1.39+ |
| PHP | 8+ |
| データベースの変更 | はい |
| テーブル | analytics_pageviews |
| ライセンス | GNU 一般公衆利用許諾書 3.0 以降 |
| ダウンロード | |
| 例 | Appropedia |
|
|
| translatewiki.net で翻訳を利用できる場合は、Analytics 拡張機能の翻訳にご協力ください | |
The Analytics extension gives access to traffic and edit analytics for the entire wiki, as well as for specific categories and pages, in three ways:
- A special page called Special:Analytics where you can explore freely through a simple UI (example)
- A Lua library called mw.ext.analytics that exposes the data to Lua modules and templates (example)
- A REST API endpoint called /analytics that exposes the data to other software and scripts (example)
インストール
- ダウンロードして、ファイルを
extensions/フォルダー内のAnalyticsという名前のディレクトリ内に配置します。
開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Analytics
- Gitでのインストールの場合のみ、PHPの依存関係をインストールするためComposerを実行します。 (合併症の可能性についてはT173141を参照。)
- 以下のコードを LocalSettings.php ファイルの末尾に追加します:
wfLoadExtension( 'Analytics' );
- 更新スクリプトを実行します。このスクリプトは、この拡張機能が必要とするデータベーステーブルを自動的に作成します。
完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。
Tracking page views
この拡張機能をインストールすると、analytics_pageviews というデータベース テーブルが作成され、各ページの1日あたりのページビューの追跡が開始されます。
However, if you're installing this extension some time after your wiki started, then the analytics_pageviews table will lack historical data.
Google Analytics (GA4) を使用している場合、この拡張機能に同梱されているメンテナンス スクリプトを使用して、以下のように過去のデータで analytics_pageviews テーブルを埋められます:
php /path/to/w/maintenance/run.php /path/to/w/extensions/Analytics/maintenance/populatePageViewsFromGA4.php --credentials /path/to/google-cloud-credentials.json --property 123456789
Then this extension will track the new pageviews and keep the analytics_pageviews table up-to-date.
しかし、ウィキがプロキシ (Cloudflare など) を使用している場合、ページ ビューの多く、あるいはほとんどがサーバーに到達しないため、この拡張機能ではそれらを追跡できません。
この問題を回避するには、GA4 を使用している場合、analytics_pageviews テーブルを最新の状態に保つために、--days 1 を指定してメンテナンス スクリプトを毎日 cron ジョブで実行してください。
If you do, you may also want to set $wgAnalyticsCountPageViews = false; in your LocalSettings.php to disable the default tracking of pageviews.
関連項目
- Extension:HitCounter - Tracks the total page views of each page
- Extension:UserPageViewTracker - Tracks who visited which page, how many times and when was the last visit
- Stable extensions/ja
- Special page extensions/ja
- GPL licensed extensions/ja
- Extensions in Wikimedia version control/ja
- LoadExtensionSchemaUpdates extensions/ja
- PageViewUpdates extensions/ja
- ScribuntoExternalLibraries extensions/ja
- All extensions/ja
- Extensions requiring Composer with git/ja
- Web Analytics extensions/ja
- Statistics extensions/ja
