Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Matamo integration for platform. #35812

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 type="text/javascript">
var _paq = (window._paq = window._paq || []);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = '${matamo_instance_url | n, js_escaped_string}';
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId','${matamo_site_id | n, js_escaped_string}']);
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
Loading