Adding Google Analytics to a Wiki
Jump to navigation
Jump to search
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.
- Log into Google Analytics
- On the left side tab menu, lower corner, click the “Admin” button
- In the second column of the Admin menu, Click “Data Streams”
- Click the “>” at the end of the line for your stream
- In the “Tagging Instructions” section of the menu, expand the “Global site tag (gtag.js)” option
- 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>