Difference between revisions of "Adding Google Analytics to a Wiki"

From apimba
Jump to navigation Jump to search
(Created page with "Assume that a google analytics account is already set up and functioning for the standard html web page fronting your wiki and that the headscript extension is installed for y...")
(No difference)

Revision as of 16:11, 22 February 2022

Assume that a google analytics account is already set up and functioning for the standard html web page fronting your wiki and that the headscript extension is installed for your wiki software.

  1. Log into Google Analytics
  2. On the left side tab menu, lower corner, click the “Admin” button
  3. In the second column of the Admin menu, Click “Data Streams”
  4. Click the “>” at the end of the line for your stream
  5. In the “Tagging Instructions” section of the menu, expand the “Global site tag (gtag.js)” option
  6. Copy the text in the window and place it in your LocalSettings.php file for your wiki. The text will be similar to below, where G-01NDZHCJMM is a user specific code so yours will be different (In other words, do not use G-01NDZHCJMM)

<script async src="https://www.googletagmanager.com/gtag/js?id=G-01NDZHCJMM"></script>

<script>

window.dataLayer = window.dataLayer || [ ];

function gtag(){dataLayer.push(arguments);}

gtag('js', new Date());

gtag('config', 'G-01NDZHCJMM');

</script>