README.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. Module: Matomo Analytics
  2. Author: Alexander Hass <https://drupal.org/user/85918>
  3. Description
  4. ===========
  5. Adds the Matomo tracking system to your website.
  6. Requirements
  7. ============
  8. * Matomo installation
  9. * Matomo website ID
  10. Installation
  11. ============
  12. * Copy the 'matomo' module directory in to your Drupal 'modules'
  13. directory as usual.
  14. Usage
  15. =====
  16. In the settings page enter your Matomo website ID.
  17. All pages will now have the required JavaScript added to the
  18. HTML footer can confirm this by viewing the page source from
  19. your browser.
  20. Page specific tracking
  21. ====================================================
  22. The default is set to "Add to every page except the listed pages". By
  23. default the following pages are listed for exclusion:
  24. /admin
  25. /admin/*
  26. /batch
  27. /node/add*
  28. /node/*/*
  29. /user/*/*
  30. These defaults are changeable by the website administrator or any other
  31. user with 'Administer Matomo' permission.
  32. Like the blocks visibility settings in Drupal core, there is a choice for
  33. "Add if the following PHP code returns TRUE." Sample PHP snippets that can be
  34. used in this textarea can be found on the handbook page "Overview-approach to
  35. block visibility" at https://drupal.org/node/64135.
  36. Custom variables
  37. =================
  38. One example for custom variables tracking is the "User roles" tracking. Enter
  39. the below configuration data into the custom variables settings form under
  40. admin/config/system/matomo.
  41. Slot: 1
  42. Name: User roles
  43. Value: [current-user:matomo-role-names]
  44. Scope: Visitor
  45. Slot: 1
  46. Name: User ids
  47. Value: [current-user:matomo-role-ids]
  48. Scope: Visitor
  49. More details about custom variables can be found in the Matomo API documentation
  50. at https://matomo.org/docs/javascript-tracking/#toc-custom-variables.
  51. Advanced Settings
  52. =================
  53. You can include additional JavaScript snippets in the custom javascript
  54. code textarea. These can be found on various blog posts, or on the
  55. official Matomo pages. Support is not provided for any customisations
  56. you include.
  57. To speed up page loading you may also cache the Matomo "piwik.js"
  58. file locally.
  59. Known issues
  60. ============
  61. Drupal requirements (https://drupal.org/requirements) tell you to configure
  62. PHP with "session.save_handler = user", but your Matomo installation may
  63. not work with this configuration and gives you a server error 500.
  64. 1. You are able to workaround with the PHP default in your php.ini:
  65. [Session]
  66. session.save_handler = files
  67. 2. With Apache you may overwrite the PHP setting for the Matomo directory only.
  68. If Matomo is installed in /matomo you are able to create a .htaccess file in
  69. this directory with the below code:
  70. # PHP 4, Apache 1.
  71. <IfModule mod_php4.c>
  72. php_value session.save_handler files
  73. </IfModule>
  74. # PHP 4, Apache 2.
  75. <IfModule sapi_apache2.c>
  76. php_value session.save_handler files
  77. </IfModule>
  78. # PHP 5, Apache 1 and 2.
  79. <IfModule mod_php5.c>
  80. php_value session.save_handler files
  81. </IfModule>