Skip to content

Commit

Permalink
Merge pull request #466 from CDLUC3/main
Browse files Browse the repository at this point in the history
Move develop forward
  • Loading branch information
rushirajnenuji authored Sep 13, 2023
2 parents c49dba8 + 5a01782 commit 155babd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions impl/ui_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def render(request, template, context={}):
"feed_cache": [], # ezidapp.management.commands.newsfeed.getLatestItems(),
"google_analytics_id": django.conf.settings.GOOGLE_ANALYTICS_ID,
"debug": django.conf.settings.DEBUG,
"matomo_site_url": django.conf.settings.MATOMO_SITE_URL,
"matomo_site_id": django.conf.settings.MATOMO_SITE_ID,
}
ctx.update(context)
templ = django.template.loader.get_template(f'{template}.html')
Expand Down Expand Up @@ -140,6 +142,8 @@ def error(request, code, content_custom=None):
"feed_cache": [], # ezidapp.management.commands.newsfeed.getLatestItems(),
"google_analytics_id": django.conf.settings.GOOGLE_ANALYTICS_ID,
"content_custom": content_custom,
"matomo_site_url": django.conf.settings.MATOMO_SITE_URL,
"matomo_site_id": django.conf.settings.MATOMO_SITE_ID,
}
# TODO: Remove this temporary workaround and modify dynamically generated HTML
# instead.
Expand Down
3 changes: 3 additions & 0 deletions settings/settings.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ ADMIN_GROUP_PID = '{{ admin_search_group_pid }}'

GOOGLE_ANALYTICS_ID = None

MATOMO_SITE_ID = 21
MATOMO_SITE_URL = 'https://matomo.cdlib.org/'

GZIP_COMMAND = '/usr/bin/gzip'
ZIP_COMMAND = '/usr/bin/zip'

Expand Down
18 changes: 18 additions & 0 deletions templates/layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@
{% endfor %}
{% endif %}
{% endif %}

<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);

(function() {
var u='{{ matomo_site_url }}';
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '{{ matomo_site_id }}']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

</head>
<body>
<!--[if lt IE 10]>
Expand Down

0 comments on commit 155babd

Please sign in to comment.