Inspiration

This project started as a Linktree clone. It was a winning submission to the Permahacks 2024 hackathon.

After winning, I thought its web analytics features were more useful than another Linktree clone. So, I scrapped the page-building features and turned Junction into an anonymous onchain web analytics platform powered by Arweave and AO you can use for any website, not just the ones build with Junction.

What Junction does

It tracks website interactions via AO processes.

When a user comes to a Junction-enabled website, a script generates a random Arweave wallet to sign AO messages with page view events sent to a dispatcher process that distributes the message to report processes that calculate metrics like page views, visitors, web3visitors, bounce rate, etc. The reports contain hourly aggregates and allow filtering by start and end date.

Website operators can then use the Junction dashboard to view these reports.

How I built Junction

I created 4 AO process definitions with Teal, a statically typed dialect of Lua.

architecture

The Junction process manages accounts.

Each account process tracks one website and manages team members and reports.

Each account has a dispatcher that receives the client's page view events via aoconnect and assigns them to the report processes.

Each report receives events from its dispatcher, handles sessions, and calculates metrics like page views, visitors, web3 visitors, load time, and bounce rate.

The split between account, dispatcher, and reports is necessary to keep memory consumption small.

The frontend is a SvelteKit app I deployed to Arweave with the help of Ewigkeit (my previous hackathon project). I used Svelte because its compiler-based approach, where many performance optimizations happen at build time, is well suited to the Permaweb SPA/PWA deployment model.

Challenges I ran into

  • Error handling with multiple AO processes is hard.
  • Memory limitations pose issues for reports for big websites over longer times

Accomplishments that I am proud of

  • Building an extensible architecture for web analytics
  • Handling anonymous web tracking with generated Arweave wallets

What I learned

  • How to find errors on ao.link, lol

What's next for Junction

More Reports

Right now, there is only basic report functionality. While the architecture allows adding all kinds of reports later, the first version focused on enabling this architecture.

Also, right now, only page views are tracked, but in theory, the browser library allows for all kinds of events with custom payloads.

Token-Based Subscription Plans

The processes know how many events they received and processed; this allows for very granular pricing. Instead of having 100,000 events for $20, customers could buy a specific number of events when paying with qAR or even USDA later.

Feedback Collection

Since sending custom events with custom payloads is possible, Junction could enable an AO-powered feedback mechanism.

Tokenization

With Vouch Protocol and Zero-Knowledge Proofs, it could be possible to keep users anonymous while ensuring sybil resistance. This way, users could be incentivized to perform specific actions on pages, or website operators could be incentivized to provide users with a good experience.

Composable Web Analytics

Since all messages are already on Arweave, they could be used to allow analytics across multiple accounts. For example, for sales funnels that start before users enter a website.

Built With

Share this project:

Updates