How connecting privacy-first web analytics with Cognee's open-source memory layer lets AI agents answer operational questions about traffic, top content, and conversions without dashboard fatigue.
The Problem: AI Agents Have Traffic Amnesia
Modern AI agents and LLM companions are great at writing code, drafting emails, and summarizing documents. But when you ask them basic questions about your business or open-source project:
"How did our new release blog post perform this week?"
"Which referrer drove the most signups yesterday?"
"What are our top 5 most visited documentation pages right now?"
The agent has no idea.
Every API call to an LLM starts from scratch. For web and product metrics, developers are forced to manually export CSVs, copy-paste numbers, or switch back and forth between analytics dashboards. The knowledge of how users discover and interact with your product remains trapped in isolated analytics silos.
For Mergetober (the open-source contribution sprint hosted by WeMakeDevs and Cognee), I set out to solve this by building a dedicated Plausible Analytics connector for Cognee.
Why Plausible Analytics?
Plausible Analytics is one of the most popular open-source, privacy-focused web analytics platforms. It delivers lightweight, cookie-free web metrics without tracking personal data. Tech startups, open-source maintainers, and developer tools around the world rely on Plausible for real-time visibility into traffic and conversions.
By connecting Plausible to Cognee, AI agents gain continuous memory of site traffic, visitor trends, page engagement, and conversion goals.
How Cognee Powers Memory: From Metrics to a Knowledge Graph
Cognee is the open-source memory engine for AI agents. Instead of treating data as disconnected text chunks, Cognee uses a multi-stage cognitive pipeline:
-
add()/remember(): Ingests raw data through data-source connectors. -
cognify(): Uses LLMs and entity extractors to build a rich knowledge graph of entities and semantic relationships. -
recall()/search(): Lets agents traverse the graph to answer questions with verifiable context.
The Document-Mode Architecture
Relational database connectors in Cognee typically yield tabular schemas. But web performance insights are most useful to agents when formatted with high-signal context.
The Plausible connector utilizes Cognee's document-mode (DOCUMENT_SOURCE_ATTR = "plausible"). Rather than dumping raw JSON numbers, the connector normalizes metrics into structured Markdown documents:
- Site Traffic & Performance Overview: High-level visitor counts, pageviews, bounce rate, and average session duration.
- Top Content & Pages: URL paths ranked by visitor volume.
- Acquisition Channels: Referral sources (GitHub, Google, Twitter, Hacker News, direct).
- Audience Demographics: Top visitor countries and device distribution (Desktop vs Mobile).
- Custom Goals & Events: Conversion triggers (signups, button clicks, downloads).
When cognify() processes these documents, it establishes graph nodes such as WebSite, WebPage, ReferralSource, and Goal, linking them through relationships like (:WebSite)-[:HAS_TOP_PAGE]->(:WebPage) and (:WebSite)-[:RECEIVES_TRAFFIC_FROM]->(:ReferralSource).
Building the Connector
The connector is implemented as a standalone package under packages/connector/plausible/ in the cognee-community repository, powered by dlt:
packages/connector/plausible/
├── README.md
├── pyproject.toml
├── cognee_community_connector_plausible/
│ ├── __init__.py
│ └── plausible.py
├── examples/
│ └── example.py
└── tests/
└── test_plausible.py
Key Engineering Features:
-
Robust Resilience & Rate Limiting: The client automatically catches HTTP
429responses and applies exponential backoff honoring theRetry-Afterheader. - Pre-Ingestion Redaction: Tokens and secrets are sanitized before logging or raising exceptions, preventing API key leakage.
-
Full Snapshot Sync & Forget-on-Delete: Configured with
write_disposition="replace". Deterministic document IDs (plausible:<site_id>:<period>:<report_type>) ensure unchanged reports aren't re-processed, while obsolete periods are purged through Cognee's automated orphan cleanup. -
Self-Hosted Support: Works with Plausible Cloud (
https://plausible.io) and self-hosted Plausible Community Edition instances by supplying a custombase_url.
Running It in 6 Lines of Code
Using the connector in any Cognee project is straightforward:
import asyncio
import os
import cognee
from cognee_community_connector_plausible import plausible_source
async def main():
# 1. Instantiate the connector source
source = plausible_source(
site_id="myproject.com",
api_key=os.environ["PLAUSIBLE_API_KEY"],
period="30d",
)
# 2. Ingest into Cognee memory
await cognee.remember(source, dataset_name="web_traffic")
# 3. Ask your AI agent anything about your site performance
answer = await cognee.search(
query_text="What were our top 3 referral sources and what was our bounce rate?",
query_type=cognee.SearchType.GRAPH_COMPLETION,
datasets=["web_traffic"],
)
print(answer)
if __name__ == "__main__":
asyncio.run(main())
Real-World Use Cases
Here is where this integration shines for development teams:
- DevRel & Community AI Assistants: "Which docs page had the highest traffic spike after our v2 launch?"
- Founder & Product Briefings: Daily standup bots that summarize weekly visitor acquisition and signup conversion rates without checking dashboards.
- Incident & Traffic Correlation: Correlating sudden server load spikes with specific referral campaigns or viral articles stored in the graph.
100% Offline Testing
To ensure reliability in CI and prevent test flakes, the test suite (tests/test_plausible.py) features 18 offline unit tests covering:
- Aggregate traffic parsing & formatting
- Top page & referral markdown compilation
- Rate limit 429 exponential backoff & token scrubbing
- Deterministic ID stability across syncs
- Document-mode invariant verification (
DOCUMENT_SOURCE_ATTR)
All 18 tests pass in under 2 seconds:
uv run --project packages/connector/plausible --with pytest pytest packages/connector/plausible/tests -v
# 18 passed in 1.25s
Conclusion & Links
Bringing Plausible Analytics into Cognee gives AI agents situational awareness of the metrics that matter most to growing products.
- GitHub PR / Community Repo: topoteretes/cognee-community
- Cognee Core: topoteretes/cognee
- Mergetober: WeMakeDevs Mergetober Hackathon
Built as part of Mergetober 2026. Happy building!
Top comments (0)