|
25 | 25 |
|
26 | 26 | <%= yield :additional_js %> |
27 | 27 |
|
28 | | -<% if (ENV['GOOGLE_ANALYTICS']) %> |
| 28 | +<% if (ENV['MATOMO_URL'].present? && ENV['MATOMO_SITE_ID'].present?) %> |
| 29 | +<!-- Matomo --> |
29 | 30 | <script type="text/javascript"> |
30 | | - // Google Analytics |
31 | | - |
32 | | - (function(i,s,o,g,r,a,m){ |
33 | | - i['GoogleAnalyticsObject']=r; |
34 | | - i[r]=i[r]||function(){ |
35 | | - (i[r].q=i[r].q||[]).push(arguments) |
36 | | - }; |
37 | | - i[r].l=1*new Date(); |
38 | | - a=s.createElement(o); |
39 | | - m=s.getElementsByTagName(o)[0]; |
40 | | - a.async=1; |
41 | | - a.src=g; |
42 | | - m.parentNode.insertBefore(a,m); |
43 | | - |
44 | | - }(window,document,'script','https://www.google-analytics.com/analytics.js','ga')); |
45 | | - |
46 | | - ga('create', '<%= ENV['GOOGLE_ANALYTICS'] %>', 'auto'); |
47 | | - ga('send', 'pageview'); |
48 | | - |
| 31 | + var _paq = window._paq || []; |
| 32 | + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ |
| 33 | + _paq.push(['trackPageView']); |
| 34 | + _paq.push(['enableLinkTracking']); |
| 35 | + (function() { |
| 36 | + var u='<%= ENV['MATOMO_URL'] %>'; |
| 37 | + _paq.push(['setTrackerUrl', u+'matomo.php']); |
| 38 | + _paq.push(['setSiteId', '<%= ENV['MATOMO_SITE_ID'] %>']); |
| 39 | + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; |
| 40 | + g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); |
| 41 | + })(); |
49 | 42 | </script> |
| 43 | +<!-- End Matomo Code --> |
50 | 44 | <% end %> |
0 commit comments