User Tools

Site Tools


google_analytics_for_mediawiki_installations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
google_analytics_for_mediawiki_installations [2014/08/19 10:57]
192.168.1.3 created
google_analytics_for_mediawiki_installations [2014/09/04 14:31] (current)
Line 1: Line 1:
-====== ​Google_Analytics_for_MediaWiki_Installations ​======+====== ​Google Analytics for MediaWiki Installations ​======
  
 Google Analytics is a wonderful tool for tracking how people interact with your website. ​ Google Analytics is a wonderful tool for tracking how people interact with your website. ​
Line 7: Line 7:
  
 =====Tips===== =====Tips=====
-*Create a property for each unique website. +  ​*Create a property for each unique website. 
-*Put the code in one centralized location and reference it on pages. Google periodically changes their code, so you don't want to have to change it in multiple places when they upgrade.+  *Put the code in one centralized location and reference it on pages. Google periodically changes their code, so you don't want to have to change it in multiple places when they upgrade.
  
 =====Installing===== =====Installing=====
-*Create a file "​analytics.js"​ and place the code snippet inside. +  ​*Create a file "​analytics.js"​ and place the code snippet inside. 
-*Upload that to your webserver. +  *Upload that to your webserver. 
-*Make sure to remove the <​script>​ and </​script>​ tags. +  *Make sure to remove the <​script>​ and </​script>​ tags. 
-*It should look like this: +  *It should look like this: 
-<syntaxhighlight lang="javascript">+<code javascript>​
  ​(function(i,​s,​o,​g,​r,​a,​m){i[['​GoogleAnalyticsObject'​]]=r;​i[[r]]=i[[r]]||function(){  ​(function(i,​s,​o,​g,​r,​a,​m){i[['​GoogleAnalyticsObject'​]]=r;​i[[r]]=i[[r]]||function(){
   (i[[r]].q=i[[r]].q||[[]]).push(arguments)},​i[[r]].l=1*new Date();​a=s.createElement(o),​   (i[[r]].q=i[[r]].q||[[]]).push(arguments)},​i[[r]].l=1*new Date();​a=s.createElement(o),​
Line 23: Line 23:
   ga('​create',​ '​UA-XXXXXXXX-1',​ '​auto'​);​   ga('​create',​ '​UA-XXXXXXXX-1',​ '​auto'​);​
   ga('​send',​ '​pageview'​);​   ga('​send',​ '​pageview'​);​
-</syntaxhighlight>+</code>
  
 =====Static Webpage===== =====Static Webpage=====
-*Add this in the <​head>​ section: +  ​*Add this in the <​head>​ section: 
-<syntaxhighlight lang="html5">+<code html5>
 <script src="/​analytics.js"></​script>​ <script src="/​analytics.js"></​script>​
-</syntaxhighlight+</code
-*Replace "/​analytics.js"​ with the url to wherever you uploaded your script file.+  *Replace "/​analytics.js"​ with the url to wherever you uploaded your script file.
  
 =====MediaWiki===== =====MediaWiki=====
-*There are a lot of tutorials that tell you to insert the code into a skin, but what if a user changes skins? What if you get tired of your skin? That method is stupid.  +  ​*There are a lot of tutorials that tell you to insert the code into a skin, but what if a user changes skins? What if you get tired of your skin? That method is stupid.  
-*Common.js is a MediaWiki special page that runs javascript on every page load. Doesn'​t that sound perfect? Bloggers are retarded. +  *Common.js is a MediaWiki special page that runs javascript on every page load. Doesn'​t that sound perfect? Bloggers are retarded. 
-*Open Common.js by going to: /​YourWiki/​index.php?​title=MediaWiki:​Common.js +  *Open Common.js by going to: /​YourWiki/​index.php?​title=MediaWiki:​Common.js 
-*Edit the page to add: +  *Edit the page to add: 
-<syntaxhighlight lang="javascript">+<code javascript>​
 document.write("<​script type='​text/​javascript'​ src='/​analytics.js'></​script>"​);​ document.write("<​script type='​text/​javascript'​ src='/​analytics.js'></​script>"​);​
-</syntaxhighlight+</code
-*This implementation adds that script tag to every page that is served, regardless of skin.+  *This implementation adds that script tag to every page that is served, regardless of skin.
  
 =====Wordpress===== =====Wordpress=====
-*No clue. Just find Yoast'​s Google Analytics plugin and enter your UA code. It worked simply, the first time.+  ​*No clue. Just find Yoast'​s Google Analytics plugin and enter your UA code. It worked simply, the first time.
google_analytics_for_mediawiki_installations.txt · Last modified: 2014/09/04 14:31 (external edit)