Extension:GoogleAnalyticsMetrics/ru
GoogleAnalyticsMetrics Статус релиза: стабильно |
|
---|---|
Реализация | Функция парсера |
Описание | Gets metrics from Google Analytics |
Автор(ы) | Ike Hecht (Tosfostalk) |
Поддерживающий(ие) | WikiTeq team |
Последняя версия | 1.0.2 (January 2023) |
Политика совместимости | В расширении есть соответствуюшая ветвь для каждого релиза MediaWiki, который является релизом долгосрочной поддержки (Long Term Support release). |
MediaWiki | 1.35, 1.39 |
Изменения в БД | Нет |
Лицензия | Лицензия не указана |
Скачать | |
Ежеквартальные загрузки | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Использование общедоступными вики | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Переведите расширение GoogleAnalyticsMetrics, если оно доступно на translatewiki.net | |
Проблемы | Открытые задачи · Сообщить об ошибке |
The GoogleAnalyticsMetrics extension gets various metrics from Google Analytics and inserts them into a wiki page using a parser function. This extension was created for WikiWorks.
The GoogleAnalyticsMetrics
extension may not be appropriate for your site if you have data security and privacy concerns.
The extensions inserts JavaScript code in each page served, and the code causes the client to contact Google services to process and aggregate data.
Your site's users will be subjected to tracking and data mining regardless of the Do Not Track or Global Privacy Control browser settings.
Установка
- Setup Google Analytics API by following Step 1 here
- Install the Google Client Library by following Step 2 here
- Enable Google Analytics Reporting API in your Google Cloud Console
- <translate> [[<tvar name=2>Special:ExtensionDistributor/GoogleAnalyticsMetrics/ru</tvar>|Download]] and move the extracted <tvar name=name>
GoogleAnalyticsMetrics/ru
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleAnalyticsMetrics%2Fru - <translate> Only when installing from Git, run <tvar name=composer>Composer</tvar> to install PHP dependencies, by issuing <tvar name=code>
composer install --no-dev
</tvar> in the extension directory.</translate> <translate> (See <tvar name=phab><translate> task <tvar name=1>T173141</tvar></translate></tvar> for potential complications.)</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'GoogleAnalyticsMetrics/ru' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Использование
The googleanalyticsmetrics
parser function takes three parameters, in the form of:
{{#googleanalyticsmetrics: metric=Name of metric|page=Название страницы|startDate=Начальная дата|endDate=Конечная дата}}
- Name of metric
- The name of the Google Analytics Metric that should be displayed. The full list of Google Analytics metrics is here. Omit the
ga:
prefix. - Название страницы
- The name of the page. This parameter is only used when the metric is a per page metric.
- Начальная дата
- Show the metric since this date (optional). Defaults to
2005-01-01
, which is the beginning of time according to Google Analytics. - Конечная дата
- Show the metric until this date (optional). Defaults to
today
.
Both date parameters use the form: Year-Month-Day.
Примеры
This example displays the number of page views for this site, from the beginning until the end of time:
{{#googleanalyticsmetrics: metric=pageviews}}
Show the number of sessions from February 3, 2011 until today.
{{#googleanalyticsmetrics: metric=session|startDate=2011-02-03}}
Show the average session duration until February 1 2012:
{{#googleanalyticsmetrics: metric=avgSessionDuration|endDate=2012-02-01}}
Show the number of page views for last month only, with the help of the ParserFunctions extension:
{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|первый день прошлого месяца}}|endDate={{#time:Y-m-d|первый день этого месяца}}}}
Or, to make that nicer:
{{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|первый день прошлого месяца}}|endDate={{#time:Y-m-d|первый день этого месяца}}}}}}
Show the number of page views for a page, from the beginning until the end of time:
{{#googleanalyticsmetrics: metric=pageviews|page=Main_Page}}
See this page for some help with formatting this extension's output.
There is also a {{#googleanalyticstrackurl:http://urlhere|link text}}
function but it only works if the ga
js library has already been loaded.
Параметры конфигурации
- $wgGoogleAnalyticsMetricsAllowed
- An array containing the name of Google Analytics metrics that are allowed to be retrieved by the extension. Defaults to
*
, which allows all metrics. - $wgGoogleAnalyticsMetricsEmail
- The email address of the Google Analytics account.
- $wgGoogleAnalyticsMetricsPath
- Path to your certificate key file.
- $wgGoogleAnalyticsMetricsViewId
- Google Analytics View ID.
См. также
File:OOjs UI icon information-progressive.svg |
- Pages with script errors
- Pages with broken file links
- Extensions by WikiTeq/ru
- Stable extensions/ru
- Parser function extensions/ru
- Extensions with manual MediaWiki version
- Extensions with no license specified/ru
- Extensions in Wikimedia version control/ru
- All extensions/ru
- Extensions not in ExtensionJson
- Google extensions/ru
- Web Analytics extensions/ru
- Statistics extensions/ru