This extension adds the Google Tag Manager snippet to every page. Right now this extension will only work with Kol-Zchut's "Helena" skin, as it requires the skin's unique hook for after- code insertion (which isn't available out-of-the-box, for some reason).
Variable | Value | Explanation |
---|---|---|
$wgGoogleTagManagerContainerID | null | Container ID or array of IDs |
$wgGoogleTagManagerMediaWikiEvents | [] | an array of MediaWiki event names, subscribed through mw.trackEvent(). Events will be pushed as-is to the dataLayer - an event name + a eventData object. |
$wgGoogleTagManagerIgnoreNsIDs | [] | An array of namespaces not to load Tag Manager in, e.g. [ NS_FILE, NS_PROJECT ] |
$wgGoogleTagManagerIgnorePages | [] | An array of page names no to load Tag Manager in |
$wgGoogleTagManagerIgnoreSpecials | ['Userlogin', 'Userlogout', 'Preferences', 'ChangePassword'] |
An array of special pages not to load Tag Manager in |
Users with the "noanalytics" right are exempt from tracking, and this will not be loaded for them. By default, only bots have this right.
The extension defines a new hook, DataLayerSetup
, which allows other extensions to add to the data layer.
See file includes/Hooks/DataLayerSetupHook
for details.
- Add a new hook, DataLayerSetup, which allows other extensions to add to the data layer.
- Add the parts using onBeforePageDisplay() and not a custom hook
- $wgGoogleTagManagerContainerID can now contain an array of IDs
- Add option to pass MediaWiki events (see
mw.trackSubscribe()
inmediawiki.js
into the dataLayer.
Lint the code
- Initial version