← Back to list

Lighting Up the Black Box: Implementing Privacy-First User Analytics in AMRIT (My C4GT 2025…

This blog shares my experience with Code for GovTech (C4GT) the journey, the challenges, and the lessons I learned while building something…

Abhijeet Waghmare · 2026-05-06 14:35 · 0 claps · 6.1 min read
#analytics #c4gt #open-source #data-analytics #productivity
Open on Medium ↗
Wiki topics: GRW · Growth & Analytics 🔒 · Cybersecurity 🔓 · Open Source ⏱️ · Productivity

Lighting Up the Black Box: Implementing Privacy-First User Analytics in AMRIT (My C4GT 2025 Experience)

This blog shares my experience with Code for GovTech (C4GT) the journey, the challenges, and the lessons I learned while building something that impacts real people.

About Me

I’m Abhijeet Waghmare, a pre-final-year student at the Indian Institute of Information Technology, Design and Manufacturing, Jabalpur (IIITDMJ). During C4GT 2025, I got the incredible opportunity to work with Piramal Swasthya Management and Research Institute (PSMRI) on a project that combined engineering and public health.

Setting the Stage: Lighting Up the Black Box

When I joined C4GT, I was assigned to a project titled “Implement User Analytics with Matomo in AMRIT.” Then I saw AMRIT and realized this wasn’t just another web app.

AMRIT (Accessible Medical Records via Integrated Technologies) is a massive, open-source digital public good with 10+ UIs and 15 APIs, serving thousands of healthcare workers and millions of beneficiaries across India.

But it had one big problem a black box.

Despite its scale, AMRIT lacked analytics. We had no user insights, no visibility into how real users interacted with the system.

We couldn’t answer questions like:

“Which features do healthcare workers use most?” “Where do users struggle in their workflow?”

Our tools told us if servers were running not how people used them. And in public health, that’s not a UX issue it’s a bottleneck that can slow down patient care.

My goal was simple yet crucial Light up that black box.

An open-source digital health platform connecting healthcare workers and beneficiaries across India.

An open-source digital health platform connecting healthcare workers and beneficiaries across India.

The Challenge: Why Analytics in Healthcare Is Hard (and Why We Chose Matomo)

My first thought was why not just use Google Analytics? But healthcare data is sensitive, and every click could carry confidential context. Sending that to third-party tools was not an option.

That’s when my mentor introduced me to Matomo, an open-source, self-hosted analytics platform. Unlike others, Matomo gives full data ownership nothing leaves your server.

It was the right fit for AMRIT, but it came with challenges:

  • Hosting and maintaining the full stack (NGINX, PHP, MySQL)
  • Ensuring data security and isolation
  • Integrating tracking across Angular UI without breaking anything

So, instead of dropping in a script, we built the entire analytics pipeline from scratch.

Designing the Architecture : Building for Scale and Privacy

Once we decided to go with Matomo, the real challenge began: How do we host and integrate an analytics platform that’s secure, private, and works across frontends without breaking anything?

We started by designing the system around two principles:

  1. Security first -> No external exposure of sensitive analytics data.
  2. Scalability and maintainability -> So that every AMRIT module could use the same analytics layer without rewriting code.

1. The Server Architecture: Privacy by Design

You can’t just expose a Matomo server to the public internet , that would be a huge security risk. So, we built a multi-layered architecture that kept everything behind secure boundaries:

  • Public IP & DNS: All external requests first go to a single, public-facing gateway.
  • NGINX as Gateway: This server acts as a gatekeeper routing requests to the right services.
  • Reverse Proxy: Requests meant for Matomo are securely tunneled to a private analytics server.
  • Private Server: The actual Matomo stack (NGINX + PHP-FPM + MySQL) runs here, fully isolated from the outside world.

This setup ensures that even though analytics data is being collected in real time, it never leaves the private network, maintaining performance and compliance.

A secure multi-layered setup using NGINX and reverse proxy keeps Matomo isolated, private, and fully under our control ensuring real-time analytics without exposing sensitive data.

A secure multi-layered setup using NGINX and reverse proxy keeps Matomo isolated, private, and fully under our control ensuring real-time analytics without exposing sensitive data.

2. The Client Architecture: One Service to Track Them All

The next challenge was on the frontend. AMRIT isn’t a single app , it’s a network of Angular-based UIs. Adding tracking code manually to each one would have been a nightmare.

So, I built a reusable TrackingService inside the Common-UI module , a shared library that every AMRIT UI depends on.

Now, instead of adding tracking code everywhere, developers can just call one simple function:

this.trackingService.trackEvent('category', 'action', 'label');t

Behind the scenes, the service handled all the complexity session management, router integration, user IDs, and communication with the Matomo backend.

The best part? If the organization ever decides to shift another analytics tool (like Google Analytics), they can plug it in behind the same interface with zero code changes in the UI.

That’s scalability in action.

A single, reusable TrackingService now powers analytics across all AMRIT UIs making event tracking simple, consistent, and easy to extend.

A single, reusable TrackingService now powers analytics across all AMRIT UIs making event tracking simple, consistent, and easy to extend.

Building the System : My 3 Months of Implementation

Phase 1: Foundation (June)

Explored AMRIT’s architecture, set up Matomo locally, and built the first version of the reusable Tracking Service. It took several iterations to make it scalable, but with mentor guidance, the foundation was ready.

Phase 2: Integration (July)

Integrated tracking into HWC-UI and Inventory-UI, set up NGINX reverse proxy with SSL, and deployed Matomo on a private server. Seeing the first real-time event appear on the dashboard was magical ✨

Phase 3: Expansion (August)

Added user-level tracking, integrated tracking into MMU-UI and ECD-UI, and created custom dashboards in Matomo for actionable insights. Finally, I wrote documentation for future contributors from setup to event tracking guidelines.

Pull requests merged across multiple AMRIT UIs from HWC to ECD marking the full rollout of Matomo-based analytics across the platform.

Pull requests merged across multiple AMRIT UIs from HWC to ECD marking the full rollout of Matomo-based analytics across the platform.

Lighting Up the Black Box : The Impact & Outcomes

After weeks of setup, testing, and integration, we finally had Matomo running smoothly across AMRIT’s major UI modules HWC-UI, Inventory-UI, MMU-UI, and ECD-UI. For the first time, the team could actually see what was happening inside the platform.

It felt like turning the lights on in a dark room.

We could now visualize real-time user interactions, identify popular features, and even spot drop-off points in workflows. To make these insights actionable, we defined a set of Key Performance Indicators (KPIs) to track engagement, performance, and accessibility across AMRIT helping the team focus on what truly mattered.

A snapshot of AMRIT’s analytics KPIs tracking usage, performance, and accessibility metrics that guide continuous improvement.

A snapshot of AMRIT’s analytics KPIs tracking usage, performance, and accessibility metrics that guide continuous improvement.

With Matomo in place, AMRIT shifted from guesswork to data-driven decisions. The team could finally pinpoint where users struggled, which workflows needed optimization, and how new features performed in the field. All of this, while keeping every bit of data private and secure within Piramal Swasthya’s infrastructure. The setup is now fully scalable and future-ready new modules can integrate analytics effortlessly, ensuring AMRIT continues to evolve with privacy and performance at its core.

Custom dashboards in Matomo turning user activity into actionable insights helping the AMRIT team improve workflows and user experience in real time.

Custom dashboards in Matomo turning user activity into actionable insights helping the AMRIT team improve workflows and user experience in real time.

By the end of the project, the black box was gone. What started as a guessing game had turned into a clear, measurable, and privacy-first analytics system that helps AMRIT continuously improve the experience for thousands of healthcare workers across India.

❤️ Learnings, Reflections, and Gratitude

This project was more than just integrating an analytics tool it was a crash course in building for scale, security, and impact. Over three months, I learned lessons that went far beyond writing code.

I learned how to design a common tracking system that works across multiple Angular applications and understood how analytics platforms like Matomo function end to end from event collection to visualization. Setting up secure servers with NGINX, SSL, and MySQL taught me the value of building for privacy and reliability from day one.

Working across multiple repositories showed me the importance of clear documentation, consistent communication, and collaborative problem-solving. Regular syncs with my mentor and team helped me see how guidance and feedback accelerate growth in real-world engineering.

Most importantly, this project reminded me that great engineering isn’t just about code it’s about solving problems that matter. Watching live, privacy-safe data flow from healthcare workers into dashboards was incredibly fulfilling. It made me appreciate how initiatives like C4GT give students the chance to build technology that directly improves lives.

I’m deeply thankful to Piramal Swasthya Management and Research Institute (PSMRI) and the Code for GovTech (C4GT) program for this opportunity. Special thanks to my mentor, Dr. Mithun James (@drtechie), for his guidance and patience throughout the journey and to the entire AMRIT team, whose collaboration made this possible.

Written by Abhijeet Waghmare, Pre-final year student at IIIT Jabalpur Mentored by Dr. Mithun James, Piramal Swasthya

Wrapping up my C4GT 2025 journey with gratitude and pride a summer of learning, building, and real impact. ❤️

Wrapping up my C4GT 2025 journey with gratitude and pride a summer of learning, building, and real impact. ❤️


메타데이터
post_id
561bdcd2810f
slug
lighting-up-the-black-box-implementing-privacy-first-user-analytics-in-amrit-my-c4gt-2025-561bdcd2810f
url
https://medium.com/@abhijeetw035/lighting-up-the-black-box-implementing-privacy-first-user-analytics-in-amrit-my-c4gt-2025-561bdcd2810f
canonical_url
https://medium.com/@abhijeetw035/lighting-up-the-black-box-implementing-privacy-first-user-analytics-in-amrit-my-c4gt-2025-561bdcd2810f
author_url
https://medium.com/@abhijeetw035
status
ok
fetched_at
2026-06-17 08:20:12