Skip to content
 
 

Latest commit

 

History

140 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ci

Web Analytics

A Moodle admin tool adding Web Analytics to your Moodle site.

Why use this plugin instead of pasting a snippet into Additional HTML?

Moodle's Additional HTML setting (Site administration > Appearance > Additional HTML) lets you paste raw JavaScript into every page. This plugin is better for several reasons:

Multi-instance management — run multiple analytics tools simultaneously, each independently enabled or disabled via the admin UI, without editing raw HTML.

User ID tracking — optionally sends $USER->id or $USER->username to Matomo or Google Analytics, something that requires custom PHP to do manually.

GDPR metadata — tools that send user IDs properly declare that external data flow via Moodle's privacy API, satisfying audit requirements.

Branches

Moodle version Branch PHP
Moodle 4.5 + MOODLE_405_STABLE 8.1+
Moodle 4.1 - 4.4 MOODLE_401_STABLE 7.4+
Moodle 3.5 - 4.0 master 7.2+

The MOODLE_405_STABLE branch is hooks-only: the deprecated before_standard_html_head callback in lib.php has been removed in favour of the core\hook\output\before_standard_head_html_generation callback registered in db/hooks.php. Use MOODLE_401_STABLE for sites still on Moodle 4.1 - 4.4.

Install instructions

  1. Copy the code to admin/tool/webanalytics directory of your Moodle instance
  2. Visit the notifications page and install the plugin
  3. Visit a plugin configuration page and add instances of required Web Analytics Tool

The plugin features the following options

  • multiple unlimited instances of different types of analytics in one Moodle site
  • exclude tracking of admin users

Supported Web Analytics Tools

The plugin currently supports following analytics tools.

Matomo (formerly Piwik)

  • Set the Site ID
  • Choose whether you want image fallback tracking
  • Enter the URL to your Matomo install excluding http/https and trailing slashes
  • Choose whether you want to track admins (not recommended)
  • Choose whether you want to send Clean URLs (recommended): Matomo will aggregate Page Titles and show a nice waterfall cascade of all sites,
  • Set alternative piwik.js URL for any purpose including categories and action types
  • Optional tracking for User ID
  • User ID could be id or username

Google Universal Analytics

  • Plugin modifies the page speed sample to have 50% of your visitors samples for page speed instead of 1% making it much more useful
  • Set your Google tracking ID
  • Choose whether you want to track admins (not recommended)
  • Choose whether you want to send Clean URLs (not recommended): Google analytics will no longer be able to use overlays and linking back to your Moodle site
  • Choose whether you want to send User ID reference
  • Choose whether you want to anonymize the IP address of the hit sent to Google Analytics

Google Tag Manager

  • Tag Manager adds Analytics page view tags, AdWords Conversion Tracking tags, and others in the Tag Manager user interface.
  • Set your Tag Manager Container ID tracking ID
  • Choose whether you want to track admins

Google Legacy Analytics (soon deprecated by Google)

  • Plugin modifies the page speed sample to have 50% of your visitors samples for page speed instead of 1% making it much more useful
  • Set your Google tracking ID
  • Choose whether you want to track admins (not recommended)
  • Choose whether you want to send Clean URLs (not recommended): Google analytics will no longer be able to use overlays and linking back to your Moodle site

Developer notes

All Web Analytics tools has implemented as Moodle subplugins. If you require to support a new web analytics tool, then add a new subplugin to "tool" folder. See existing subplugins as a code example.

Crafted by Catalyst IT

This plugin was developed by Catalyst IT Australia:

https://www.catalyst-au.net/

Catalyst IT

Contributing and Support

Issues, and pull requests using github are welcome and encouraged!

https://github.com/catalyst/moodle-tool_webanalytics/issues

If you would like commercial support or would like to sponsor additional improvements to this plugin please contact us:

https://www.catalyst-au.net/contact-us

About

A Moodle admin tool adding Web Analytics to your Moodle site.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages