Inside LiFi’s Architecture

Understanding how LiFi works under the hood gives users a deeper appreciation of the privacy, performance, and intelligence built into the system. This page offers a clear explanation of the key components that power the LiFi Chrome Tracker and how they all work together to deliver local-first, privacy-respecting analytics.

Background Scripts and Content Scripts

Chrome extensions are powered by multiple scripts that perform distinct tasks. In LiFi, two of the most important are the background script and the content script.

Background Script

The background script acts as the brain of the extension. It runs continuously in the background and is responsible for:

  • Listening to browser events like page loads, tab switches, and navigation completions

  • Managing communication between different parts of the extension

  • Handling data storage operations

  • Monitoring cookies and managing tracking preferences

  • Coordinating AI analysis based on browsing behavior

It does not directly interact with the web pages users visit, but instead acts as a control center that handles everything behind the scenes.

Content Script

The content script is injected into every webpage the user visits. It runs inside the page’s context and is responsible for collecting data such as:

  • The page title, URL, and referring site

  • Search queries entered into search forms

  • Clicks, scrolls, hovers, and other interactions

  • Product views and e-commerce activity

It sends this data to the background script for further processing. Content scripts are isolated from the website itself and do not interfere with the content or functionality of the page.

Options Page and Popup Interface

LiFi includes two interfaces designed for user control and interaction — the full analytics dashboard and a lightweight popup panel.

Options Page

This is the primary dashboard where users can view their browsing data in detail. It includes:

  • A summary of total browsing time, top sites, and visit frequency

  • A full browsing history organized chronologically

  • Tabs for viewing specific interactions like searches, clicks, and scroll activity

  • A tab for AI-generated insights and summaries of behavior

  • Tools for exporting or deleting your data at any time

The options page is designed to be responsive, easy to navigate, and privacy-transparent. Everything you see has been collected and stored on your own device.

The popup is a quick-access window that opens when you click the LiFi icon in your browser. It provides:

  • A switch to turn tracking on or off

  • A snapshot of the current browsing session

  • Access to privacy settings

This interface is minimal by design, giving you quick control without needing to open the full dashboard.

Utility Services

LiFi uses a collection of behind-the-scenes services that ensure everything runs smoothly and efficiently. These utility services are modular, meaning they each handle one specific responsibility.

Data Processing

After the content script collects data, it must be cleaned and formatted before being stored. The data processing service handles:

  • Removing duplicate or irrelevant data

  • Assigning accurate timestamps and identifiers

  • Calculating session durations and scroll depth

  • Preparing insights-ready data structures

Storage Management

All of your data is stored locally using Chrome’s secure storage system. This service handles:

  • Adding new data as events occur

  • Organizing data by category (navigation, interactions, etc.)

  • Retrieving data quickly for display in the dashboard

  • Exporting all collected data in a single file

Your data never leaves your device unless you choose to export it yourself.

AI Integration

To give users meaningful insights, LiFi uses a built-in integration with the Google Gemini API. This service is responsible for:

  • Creating smart prompts based on your activity data

  • Sending those prompts to the AI for analysis

  • Receiving and organizing AI-generated summaries

  • Providing fallback summaries when the AI is unavailable

All AI analysis is done securely, and only when you enable it.

Why Modularity Matters

LiFi is built on a modular architecture, which means every feature and service operates independently. This is a foundational design choice that brings major advantages in four key areas:

Performance

Modular components only load when needed. This keeps the extension lightweight and fast, even when handling large volumes of data.

Maintainability

If something needs fixing or updating — like how a certain type of data is tracked — it can be done in isolation without affecting the rest of the system.

Privacy

Modularity enforces strict boundaries between parts of the system. Sensitive data stays within the tracking module and isn’t exposed to unrelated components.

Scalability

New features, like advanced visualizations or third-party plugins, can be added as separate modules without rewriting the entire codebase. This makes LiFi future-ready.

Summary

LiFi’s architecture is thoughtfully designed to give users a powerful, privacy-first analytics experience without compromising performance or control. By breaking the system down into clearly defined components, background scripts, content scripts, utility services, and user interfaces, LiFi can:

  • Track and analyze user behavior locally

  • Process and present insights without exposing data

  • Offer full transparency and user control

  • Scale efficiently while staying lightweight

This modular, intelligent design is what makes LiFi more than just a tracker, it’s your personal browsing analytics engine, built for insight and privacy.

Last updated