Skip to content

Commit

Permalink
feat: Add Matamo integration for platform.
Browse files Browse the repository at this point in the history
Matamo integration for the platform. This adds the integration to the
landing page.

Signed-off-by: Farhaan Bukhsh <[email protected]>
  • Loading branch information
farhaanbukhsh committed Nov 9, 2024
1 parent d197077 commit 199bb91
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,10 @@ def _make_mako_template_dirs(settings):
GOOGLE_ANALYTICS_TRACKING_ID = None
GOOGLE_ANALYTICS_4_ID = None

######################## MATAMO ANALYTICS ####################
MATAMO_SITE_ID = None
MATAMO_INSTANCE_URL = None

######################## BRANCH.IO ###########################
BRANCH_IO_KEY = ''

Expand Down
22 changes: 22 additions & 0 deletions lms/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,28 @@
</script>
% endif


<% matamo_site_id = static.get_value("MATAMO_SITE_ID", settings.MATAMO_SITE_ID) %>
<% matamo_instance_url = static.get_value("MATAMO_INSTANCE_URL", settings.MATAMO_INSTANCE_URL) %>
% if matamo_site_id and matamo_instance_url:
<script>
var _paq = (window._paq = window._paq || []);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = '${matamo_instance_url}';
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId','${matamo_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>
% endif

<% branch_key = static.get_value("BRANCH_IO_KEY", settings.BRANCH_IO_KEY) %>
% if branch_key and not is_from_mobile_app:
<script type="text/javascript">
Expand Down

0 comments on commit 199bb91

Please sign in to comment.