GA4 for OpenMRS

OpenMRS is a global community that has developed an open-source Electronic Medical Record system (EMR), created to support healthcare in low and middle-income countries. It serves as a replacement for traditional, paper records, improving the workflow inside of a healthcare facility, as well as the quality of diagnosis and treatments. As result, it enables medical workers to successfully treat even more people and save even more lives.

Spectrum of a Project


Our Goal

Configuring Google Analytics 4 for accurate website data analysis, and assistance in managing the GA4 account.



General disorganization on the Google Analytics account. There were pages that had multiple services created, some of them worked, others did not.

Our strategy

  1. Connecting the already existing Universal Analytics with the new Google Analytics 4.
  2. Creating an account in Google Tag Manager.
  3. Creating a tag for the website.
  4. Implementing the code of the tag into the source code of the website.
  5. Updating the code that is responsible for GA4’s instance in the WordPress plug-in, allowing the data to be transferred between two devices.
  6. Checking in the GA4 if the data is being transferred.

The Case

Our Foundation has a lot of experience in collaborating with various open-source projects, and supporting their development. OpenMRS is one of our biggest and closest partners in this field. Considering our long-lasting partnership, we offered the OpenMRS community our help with configuring and managing Google Analytics. Our purpose was to provide them with improved data, and take the responsibility of analytics on our shoulders, so that they do not have to worry about it. The OpenMRS community is built by many people from all over the world. They put a lot of time and effort into the development of the software. It can get hard to take care of the marketing matters as well. We have decided to use our skills and make our contribution to this important and, for many, life-changing project.


Our first step was to ask the community for their viewpoint on the case. We wrote a post on the OpenMRS community forum – OpenMRS Talk. It was met with great interest and enthusiasm. Having gotten the green light, we quickly got down to work.


During the configuration we have found many errors that prevented data from being collected. Multiple services were incorrectly implemented into the source code of the website. We called them “the phantom services”. We replaced them with the new Google Analytics 4 services. After correctly implementing the code from Google Tag Manager into the source code, data finally started to flow.


We are convinced that having a well-organized and correctly configured marketing tool, such as Google Analytics 4, will be of great help to the OpenMRS community in making plans for the future. Having this problem out of the way, the OpenMRS developers can focus solely on what they do best – improving the program that saves people’s lives.


We are very proud that we could use our skills and knowledge to contribute to the development of this open source. We will continue to support the OpenMRS community with our time and our skills.


On the 1st of July 2023, Universal Analytics will be shut down, and fully replaced by Google Analytics 4. The creators of both services recommend preparing for this change and configuring GA4 as soon as possible, in order to start collecting data, and smoothly transfer to the new analytics platform without any additional losses.