README.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. Module: Google Analytics
  2. Author: Alexander Hass <http://drupal.org/user/85918>
  3. Description
  4. ===========
  5. Adds the Google Analytics tracking system to your website.
  6. Requirements
  7. ============
  8. * Google Analytics user account
  9. Installation
  10. ============
  11. Copy the 'googleanalytics' module directory in to your Drupal
  12. sites/all/modules directory as usual.
  13. Upgrading from 6.x-3.x and 7.x-1.x
  14. ==================================
  15. If you upgrade from 6.x-3.x and 7.x-1.x (ga.js) to 7.x-2.x (analytics.js) you
  16. should verify if you used custom variables. Write down your settings or make a
  17. screenshot. You need to re-configure the settings to use custom dimensions or
  18. metrics. There is no automatic upgrade path for custom variables feature. All
  19. other module settings are upgraded automatically.
  20. See https://support.google.com/analytics/answer/2795983?hl=en for more details.
  21. Usage
  22. =====
  23. In the settings page enter your Google Analytics account number.
  24. All pages will now have the required JavaScript added to the
  25. HTML footer can confirm this by viewing the page source from
  26. your browser.
  27. Page specific tracking
  28. ======================
  29. The default is set to "Add to every page except the listed pages". By
  30. default the following pages are listed for exclusion:
  31. admin
  32. admin/*
  33. batch
  34. node/add*
  35. node/*/*
  36. user/*/*
  37. These defaults are changeable by the website administrator or any other
  38. user with 'Administer Google Analytics' permission.
  39. Like the blocks visibility settings in Drupal core, there is a choice for
  40. "Add if the following PHP code returns TRUE." Sample PHP snippets that can be
  41. used in this textarea can be found on the handbook page "Overview-approach to
  42. block visibility" at http://drupal.org/node/64135.
  43. Custom dimensions and metrics
  44. =============================
  45. One example for custom dimensions tracking is the "User roles" tracking.
  46. 1. In the Google Analytics Management Interface (http://www.google.com/analytics/)
  47. you need to setup Dimension #1 with name e.g. "User roles". This step is
  48. required. Do not miss it, please.
  49. 2. Enter the below configuration data into the Drupal custom dimensions settings
  50. form under admin/config/system/googleanalytics. You can also choose another
  51. index, but keep it always in sync with the index used in step #1.
  52. Index: 1
  53. Value: [current-user:role-names]
  54. More details about custom dimensions and metrics can be found in the Google API
  55. documentation at https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
  56. Advanced Settings
  57. =================
  58. You can include additional JavaScript snippets in the custom javascript
  59. code textarea. These can be found on the official Google Analytics pages
  60. and a few examples at http://drupal.org/node/248699. Support is not
  61. provided for any customisations you include.
  62. To speed up page loading you may also cache the Google Analytics "analytics.js"
  63. file locally.
  64. Manual JS debugging
  65. ===================
  66. For manual debugging of the JS code you are able to create a test node. This
  67. is the example HTML code for this test node. You need to enable debugging mode
  68. in your Drupal configuration of Google Analytics settings to see verbose
  69. messages in your browsers JS console.
  70. Title: Google Analytics test page
  71. Body:
  72. <ul>
  73. <li><a href="mailto:foo@example.com">Mailto</a></li>
  74. <li><a href="/files/test.txt">Download file</a></li>
  75. <li><a class="colorbox" href="#">Open colorbox</a></li>
  76. <li><a href="http://example.com/">External link</a></li>
  77. <li><a href="/go/test">Go link</a></li>
  78. </ul>
  79. Text format: Full HTML