Skip to content

Commit

Permalink
fixup! chore: Add matamo integration doc
Browse files Browse the repository at this point in the history
  • Loading branch information
farhaanbukhsh committed Jan 10, 2025
1 parent 2c8aa46 commit 979a717
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions source/site_ops/how-tos/matamo-analytics.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Configuring Matamo Analytics
#############################
Configuring Analytics
######################

In addition to Google Analytics, the Open edX platform is flexible enough to support different analytics tools.

Expand All @@ -13,8 +13,37 @@ Matamo needs to be included under the head tag of the page; hence, we will use h

1. Create the head-extra.html file under {theme}/lms/templates/.
2. Add the script provided by the platform to the file.

For example:

.. code-block:: html

<!-- 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 = "//analytics.demo-instance.com/";
_paq.push(["setTrackerUrl", u + "matomo.php"]);
_paq.push(["setSiteId", "4"]);
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 -->

This should be the content of html page for head-extra.html.

3. Apply the theme, and we are good to go.

Note::
Just like how Matamo is integrated we can use other analytics tools as well.

.. note::

This will only be applied to the pages served by LMS and would not be supported by different MFEs used by the platform. Hence, to introduce the same, you need to create a custom component and put it in a slot. You can have a look at the `frontend-footer-component <https://github.com/openedx/frontend-component-footer>`_.
This will only be applied to the pages served by LMS and would not be supported by different MFEs used by the platform. Hence, to introduce the same, you need to create a custom component and put it in a slot. You can have a look at the `frontend-footer-component <https://github.com/openedx/frontend-component-footer>`_.

0 comments on commit 979a717

Please sign in to comment.