@regis Hello i would like to ask how can i add google analytics at studio cms
I used plugin for tutor
See: https://docs.tutor.overhang.io/plugins.html#
Deploy custom ones
eg. https://gist.github.com/d-demirci/89b2275edd1b2fb55055f49ff4d4282c (for custom certificates ).
- run
tutor plugins printrootto check whereTUTOR_PLUGINS_ROOTare installed, default is~/.local/share/tutor-plugins -
add the YAML file
custom_cert.ymlunder~/.local/share/tutor-plugins:
# cp custom_cert.yml /root/.local//share/tutor-plugins
- install the plugin:
tutor plugins install custom_cert.yml - enable it:
tutor plugins enable customcert - save the config:
tutor config save - restart tutor:
tutor local reboot -d
AS you enabling the plugin does not require rebuilding the image or even reconfiguring with tutor local quickstart , hence the simple turor local reboot -d .
Enabling the plugin updates itself the Tutor’s config.yml :
PLUGINS:
- customcert
WEB_PROXY: false
Even more interesting is enabling Analytics! as a plugin (Tutor covers Google Analytics : https://docs.tutor.overhang.io/plugins/examples.html#enable-google-analytics).
Matomo Analytics for our MOOC.
-
created in
analytics.dschool.edu.grasMooc-DEVwithSiteId: 34. - tracking code :
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.dev.mooc.edu.gr"]);
_paq.push(["setDomains", ["*.dev.mooc.edu.gr"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.dschool.edu.gr/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '34']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="https://analytics.dschool.edu.gr/matomo.php?idsite=34&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Matomo Code -->
-
create our own
matomoplugin :- matomo.yml :
name: matomoanalytics
version: 0.1.0
patches:
openedx-common-settings: |
# googleanalytics special settings
# GOOGLE_ANALYTICS_ACCOUNT = "UA-654321-1"
MATOMO_ANALYTICS_TRACKING_ID = "34"
and install it in /root/.local/share/tutor-plugins .
-
enable it with :
tutor plugins enable matomoanalyticstutor config save
- check it is enabled with :
# turor plugins list
xqueue==10.1.0 (disabled)
customcert==0.1.0
matomoanalytics==0.1.0
and also with:
# grep -ril MATOMO /root/.local/share/tutor/env/apps/openedx/settings/
lms/__pycache__/production.cpython-35.pyc
lms/production.py
lms/development.py
cms/__pycache__/production.cpython-35.pyc
cms/production.py
cms/development.py
and see that indeed the MATOMO_ANALYTICS_SITE_ID is indeed in the settings files, eg.
[root@dev.mooc.edu.gr]:~/.local/share/tutor/env/apps/openedx/settings# grep MATOMO lms/production.py
MATOMO_ANALYTICS_TRACKING_ID = "34"
-
restart the platform
tutor local quickstart
- or rahter rebuild the local image :
turor local build openedx.
After that i’ve inserted the script at footer.html in lms and it works on lms
https://dev.mooc.edu.gr/
Where should i add the same script at cms?
Thank you in advance

I have never added analytics to the CMS myself, but it seems to me that you should modify the