Extension:GTag
From Linux Web Expert
GTag Release status: stable |
|
---|---|
Implementation | User activity |
Description | Add Google Analytics tracking to pages |
Author(s) | Skizzerztalk |
Latest version | 1.3.0 (2023-07-14) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | 1.35+ |
Database changes | No |
License | MIT License |
Download | |
|
|
gtag-exempt |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The GTag extension lets you insert the new Google Analytics tracking tag on your MediaWiki site ("gtag.js").
Download
This extension can be downloaded as a .tar.gz file, here (you must first register on mwusers.org in order to download the file).
You can also download the extension via Git from its GitHub repository, by calling the following:
git clone https://github.com/SkizNet/mediawiki-GTag/
Installation
- <translate> Download and place the file(s) in a directory called <tvar name=name>
GTag
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'GTag' ); $wgGTagAnalyticsId = 'UA-xxxxxxxxx-x' or 'G-XXXXXXXX'; // replace this with your Google Analytics id
- 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>
Configuration parameters
- $wgGTagAnalyticsId (string)
- Google Analytics id, required.
- $wgGTagAnonymizeIP (boolean, default false)
- If true, anonymize the IP address sent to Google Analytics.
- $wgGTagEnableTCF (boolean, default false)
- If true, support the IAB Transparency & Consent Framework used by many 3rd party cookie consent widgets. You will need to implement such a widget yourself into your wiki; the extension does not come with one.
- $wgGTagHonorDNT (boolean, default true)
- If true, honor "Do Not Track" requests from browsers. If false, ignore such requests.
- $wgGTagTrackSensitivePages (boolean, default true)
- If true, insert tracking code into sensitive pages such as Special:UserLogin and Special:Preferences. If false, no tracking code is added to these pages.
User rights
- gtag-exempt
- Users granted this right will not be tracked by Google Analytics. This can be useful to exempt staff groups from being tracked, to get a better idea of what your end users are doing on the wiki.
See also
- Extension:Google Analytics Integration - Provides similar features although it uses a different/older Google Analytics API to perform tracking. The GTag extension makes use of the newer Google Site Tag feature to perform tracking.
- Extension:GoogleTagManager
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
Categories:
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- User activity extensions
- Extensions with master compatibility policy
- Extensions with manual MediaWiki version
- MIT licensed extensions
- Extensions in GitHub version control
- Extensions which add rights
- BeforePageDisplay extensions
- All extensions
- Web Analytics extensions
- Google extensions