Skip to content

Commit 25a5b9f

Browse files
committed
switch analytics to using matomo
1 parent cf805b3 commit 25a5b9f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

_includes/javascript.html

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,27 @@
55
<script src="{{ relative_root_path }}/assets/js/bootstrap.min.js"></script>
66
<script src="{{ relative_root_path }}/assets/js/lesson.js"></script>
77

8+
{% if site.kind == "lesson" %}
9+
<!-- Matomo -->
810
<script>
9-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
10-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
11-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
12-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
13-
ga('create', 'UA-37305346-2', 'auto');
14-
ga('send', 'pageview');
11+
var _paq = window._paq = window._paq || [];
12+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
13+
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
14+
_paq.push(["setDomains", ["*.lessons.carpentries.org","*.datacarpentry.github.io","*.datacarpentry.org","*.librarycarpentry.github.io","*.swcarpentry.github.io"]]);
15+
_paq.push(["setDoNotTrack", true]);
16+
_paq.push(["disableCookies"]);
17+
_paq.push(['trackPageView']);
18+
_paq.push(['enableLinkTracking']);
19+
(function() {
20+
var u="https://carpentries.matomo.cloud/";
21+
_paq.push(['setTrackerUrl', u+'matomo.php']);
22+
_paq.push(['setSiteId', '1']);
23+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
24+
g.async=true; g.src='//cdn.matomo.cloud/carpentries.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
25+
})();
1526
</script>
27+
<!-- End Matomo Code -->
28+
{% endif %}
1629

1730
{% if page.math %}
1831
<script src="{{ relative_root_path }}/assets/js/katex.min.js"></script>

0 commit comments

Comments
 (0)