Page MenuHomePhabricator

Setup & integrate analytics on design.wikimedia.org
Closed, ResolvedPublic1 Estimated Story Points

Description

We'd like to have basic analytics for this upcoming “small” entity design.wikimedia.org. Similar was accomplished for RLP in T186819

We're aware that

  • Matomo (formerly known as Piwik) is a low-availability tool for medium/small sized sites (up to a few thousand visits a day) &
  • data is mostly incorrect for past day

Event Timeline

Volker_E triaged this task as Medium priority.Mar 2 2018, 10:11 PM
Volker_E created this task.
Volker_E added a project: Analytics-Kanban.

@Nuria, the domain is live. Would you provide us with an instance?

Snipets:

<!-- Piwik -->
<script type="text/javascript">

var _paq = _paq || [];
_paq.push(["setDomains", ["*.design.wikimedia.org."]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
  var u="//piwik.wikimedia.org/";
  _paq.push(['setTrackerUrl', u+'piwik.php']);
  _paq.push(['setSiteId', '16']);
  var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
  g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();

</script>
<noscript><p><img src="//piwik.wikimedia.org/piwik.php?idsite=16" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

<!-- Piwik Image Tracker-->
<img src="https://piwik.wikimedia.org/piwik.php?idsite=16&rec=1" style="border:0" alt="" />
<!-- End Piwik -->

I gave access to reserach user (since i think you mentioned you already had that one)

Nuria set the point value for this task to 1.Mar 26 2018, 6:06 PM
Nuria moved this task from In Progress to Ready to Deploy on the Analytics-Kanban board.

@Nuria Thanks for the quick action and the snippet. Just to clarify, these two entities are for different teams, I'm suspicious if having them under one user is the right way?

For an explanation for the “image tracker” above, only with addition of rec=1 parameter, non-JS users are tracked too. https://matomo.org/faq/how-to/faq_176/

For documentation purposes, the further adapted (loading optimized, HTML5 markup, HTTPS and JS coding style featuring) script:

	<script>
		var _paq = _paq || [];
		_paq.push(['setDomains', ['*.design.wikimedia.org.']]);
		_paq.push(['trackPageView']);
		_paq.push(['enableLinkTracking']);
		function embedTrackingCode() {
			var u='https://piwik.wikimedia.org/';
			_paq.push(['setTrackerUrl', u+'piwik.php']);
			_paq.push(['setSiteId', '1']);
			var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
			g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
		}
		if (window.addEventListener) {
		    window.addEventListener('load', embedTrackingCode, false);
		} else if (window.attachEvent) {
		    window.attachEvent('onload',embedTrackingCode);
		} else {
		    embedTrackingCode();
		}
	</script>

into <head>

Thanks for the quick action and the snippet. Just to clarify, these two entities are for different teams, I'm suspicious if having them under one user is the right way?

If you are working on both sites i think is fine, if you feel strongly otherwise let me know.

@Volker_E Are we going to be using this for the landing page as well?

Change 422902 had a related patch set uploaded (by Prtksxna; owner: Prtksxna):
[design/landing-page@master] Add analytics code snippet

https://gerrit.wikimedia.org/r/422902

Change 422902 merged by VolkerE:
[design/landing-page@master] Add analytics code snippet

https://gerrit.wikimedia.org/r/422902

Volker_E claimed this task.
Volker_E removed a project: Patch-For-Review.
Volker_E removed a subscriber: gerritbot.