Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GTag Extension for MediaWiki

The GTag extension lets you insert the new Google Analytics tracking tag on your MediaWiki site (gtag.js).

Requirements

  • MediaWiki 1.39 or later

Installation

Download the extension and extract it to your wiki's extensions/ directory.

To install the extension, add the following to your LocalSettings.php file:

wfLoadExtension( 'GTag' );
$wgGTagAnalyticsId = 'GT-XXXXXXXX'; // replace with your GA id or GTM id

Configuration

In addition to the required $wgGTagAnalyticsId, this extension features many optional configuration variables that you may add to your LocalSettings.php file.

Variable Default Description
$wgGTagAnalyticsId none Google Analytics ID or Google Tag Manager container ID, for example 'GT-NNVDXRX5' or 'GTM-MG9RFZQQ'. Required.
$wgGTagAnonymizeIP false If true, anonymize IP addresses sent to Google Analytics. Ignored when operating in Google Tag Manager mode.
$wgGTagEnableTCF false If true, enable support for the IAB Transparency & Consent Framework. Ignored when operating in Google Tag Manager mode.
$wgGTagHonorDNT false If true, honor "Do Not Track" requests from browsers. If false, ignore such requests.
$wgGTagTrackSensitivePages 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.

In addition to these configuration variables, you may assign the right gtag-exempt to user groups to prevent them from being tracked. This can be useful to give to staff groups so that your internal users and staff are not tracked, giving you a better idea of who is actually using your site. For example:

$wgGroupPermissions['sysop']['gtag-exempt'] = true;

Support

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages