Configuring Google Analytics#

As of May 2023 edx-platform supports Google Analytics 4 and the deprecated Google Universal Analytics. Google Universal Analytics is being turned off for all customer who don’t have the paid service “Google Analytics 360” on July 1, 2023.

More information on Universal Analytics deprecation can be found in this Google help posting.

Details on migrating to Google Analytics 4 can be found in another help posting.

This document pertains to configuring Google Analytics 4.

As of May 2023 Google Analytics 4 is supported in most edx-platform LMS templates and the following micro-frontends (MFEs) in the upcoming Olive.4 and Palm named releases:

  • Learning

  • Profile

  • Authentication

  • Account

  • Discussions

Adding Google Analytics 4#

  1. Create a Google Analytics 4 property:

    • Go to the Google Analytics website and create a new account if you don’t have one already.

    • Create a new property by selecting “Create Property” and following the instructions.

  2. Creating the ‘MEASUREMENT ID’:

    • In the Admin section of your Google Analytics 4 property, select “Data Streams” and create a new stream.

    • Choose “Web” as the stream type and provide your website URL.

    • Copy the ‘MEASUREMENT ID’.

    A screenshot of the Google Analytics interface showing the location of the MEASUREMENT ID.
  3. Add ‘MEASUREMENT ID’ to your Open edX installation:

    Enabling or disabling Google Analytics 4 in the platform and all supported MFEs is done by the presence of the measurement id in edx-platform configuration. Simply adding the id to your site will turn the feature on. This can be accomplished by either adding it directly into the your settings file:

    GOOGLE_ANALYTICS_4_ID = "G-123AV45",
    MFE_CONFIG = {
        "GOOGLE_ANALYTICS_4_ID": "G-123AV45"

    Or via the admin interface via site configuration (ex: http://localhost:18000/admin/site_configuration ), making sure that the configuration is marked enabled.

        "MFE_CONFIG": {
    A screenshot of the LMS Django Admin interface showing where to place the configuration snippet.

Confirming the Configuration#

After the above steps are complete, the Google Analytics javascript and tracking code should be added to edx-platform templated pages and MFEs where it is configured:

edx-platform templates#

A screenshot of the course dashboard. A screenshot of the course dashboard source code showing where to locate the GA4 snippet.

MFE pages#

A screenshot of the Learning MFE. A screenshot of the source code showing where to locate the GA4 snippet.