Extension:GoogleAnalyticsMetrics/pl

This extension is professionally maintained by the WikiTeq team.
WikiTeq provides official support for MediaWiki LTS releases only. It may work with other MediaWiki releases.
Category:Extensions by WikiTeq/pl Category:GPL licensed extensions/pl
Podręcznik rozszerzeń MediaWiki
GoogleAnalyticsMetrics
Status wydania: stabilneCategory:Stable extensions/pl
Realizacja Funkcja parsera Category:Parser function extensions/pl
Opis Gets metrics from Google Analytics
Autor(zy) Ike Hecht (Tosfosdyskusja)
Opiekun(owie) WikiTeq team
Ostatnia wersja 1.0.2 (styczeń 2023)
Polityka zgodności Dla każdego wydania MediaWiki, które jest wydaniem wsparcia długoterminowego, istnieje odpowiednia gałąź w rozszerzeniu.
MediaWiki 1.35, 1.39Category:Extensions with manual MediaWiki version
Zmiany w bazie danych Nie
Licencja Licencja GNU General Public License 2.0 lub nowsza
Pobieranie Category:Extensions in Wikimedia version control/pl
  • $wgGoogleAnalyticsMetricsViewId
  • $wgGoogleAnalyticsMetricsExpiry
  • $wgGoogleAnalyticsMetricsAllowed
Quarterly downloads 2 (Ranked 112nd)
Przetłumacz rozszerzenie GoogleAnalyticsMetrics jeżeli jest dostępne na translatewiki.net
Problemy Otwarte zadania · Zgłoś błąd
Category:All extensions/pl

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.

Instalacja

  • Setup Google Analytics API by clicking the button here
  • Install the Google Client Library for PHP by following the installation instructions here: here
  • Enable Google Analytics Reporting API in your Google Cloud Console
    • Grant Analytics API rights to a project
    • Create credentials in the project, adding a service account
    • Within the service account, create a new key in JSON format. Store the key file on your server on a path not accessible to the public.
    • Save the service account details in appropriate configuration parameters at the bottom of LocalSettings.php
  • Pobierz i umieść plik(i) w katalogu o nazwie GoogleAnalyticsMetrics w folderze extensions/.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/GoogleAnalyticsMetrics
  • Tylko w przypadku instalacji z repozytorium git należy uruchomić Composer, aby zainstalować zależności PHP, poprzez wywołanie composer install --no-dev w katalogu rozszerzenia. (Zobacz T173141 w celu uzyskania informacji o możliwych komplikacjach.)Category:Extensions requiring Composer with git/pl
  • Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
    wfLoadExtension( 'GoogleAnalyticsMetrics' );
    
  • Yes Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.


Użycie

The googleanalyticsmetrics parser function takes three parameters, in the form of:

{{#googleanalyticsmetrics: metric=Name of metric|page=Page Name|startDate=Początek|endDate=Koniec}}
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.
Page Name
The name of the page. This parameter is only used when the metric is a per page metric.
Start date
Show the metric since this date (optional). Defaults to 2005-01-01, which is the beginning of time according to Google Analytics.
End date
Show the metric until this date (optional). Defaults to today.

Both date parameters use the form: Year-Month-Day.

Examples

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|pierwszy dzień poprzedniego miesiąca}}|endDate={{#time:Y-m-d|pierwszy dzień tego miesiąca}}}}

Or, to make that nicer:

{{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|pierwszy dzień poprzedniego miesiąca}}|endDate={{#time:Y-m-d|pierwszy dzień tego miesiąca}}}}}}

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.

Parametry konfiguracyjne

$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.

Zobacz też

Category:Google extensions/pl Category:Web Analytics extensions/pl Category:Statistics extensions/pl
Category:All extensions/pl Category:Extensions by WikiTeq/pl Category:Extensions in Wikimedia version control/pl Category:Extensions included in Canasta/pl Category:Extensions requiring Composer with git/pl Category:Extensions with manual MediaWiki version Category:GPL licensed extensions/pl Category:Google extensions/pl Category:ParserFirstCallInit extensions/pl Category:Parser function extensions/pl Category:Stable extensions/pl Category:Statistics extensions/pl Category:Web Analytics extensions/pl