Web & product analytics · Quick take

The right algorithm isn’t always the newest

How do you group similar website journeys? I used Levenshtein edit distance to compare paths by their differences, choosing an approach that fit the question.

When is a familiar algorithm the better choice?

Levenshtein edit distance counts the fewest insertions, deletions, and substitutions needed to turn one sequence into another. For website pathing, it provides a way to compare journeys. Its usefulness depends on whether those differences capture the behavior you want to understand.

I used clustering based on Levenshtein edit distance for website pathing rather than an HDBSCAN approach. Levenshtein gives you a concrete way to compare sequences: how many insertions, deletions, or substitutions separate them? It makes the meaning of similarity something you can explain and examine.[1]

The useful discipline is to define the question, decide which differences in the data matter, and choose a method whose assumptions fit. Then check whether the result helps with the decision. That means examining what the groups have in common, where they break down, and why.

A note on the methods

Levenshtein is a distance measure; HDBSCAN is a clustering algorithm. HDBSCAN can itself use precomputed Levenshtein distances. The choice here was how to compare website paths and use those distances for clustering.[1][2]

It’s easy to chase the state of the art and overcomplicate the problem. Sometimes the right solution isn’t especially exciting. It just fits.

Sources & further reading

  1. Levenshtein distance

    NIST Dictionary of Algorithms and Data Structures · Accessed

    Technical definition of edit distance and its insertion, deletion, and substitution operations.

  2. Basic Usage of HDBSCAN: Distance matrices

    HDBSCAN documentation · Accessed

    Explains precomputed distance matrices, including Levenshtein distances, as input to HDBSCAN.

Cookies & local storage

With your permission, this site uses Google Analytics 4 through Google Tag Manager to understand visits to its reviewed public pages, LinkedIn, contact-button, draft-résumé and reviewed article clicks, Skills category choices, contact messages accepted for delivery and their selected purpose, and searches for recognized skills. Until you accept, no Google analytics script or request is loaded. Google receives analytics cookie identifiers, approximate location derived from the connection, and browser/device and usage information. Advertising storage, Google signals, ad personalization, and user-provided data collection are disabled. Analytics cookies (_ga and a property-specific _ga_* cookie) last up to 180 days without automatic renewal. Event-level data is retained for 2 months; aggregate reports can remain longer. Your choice is saved locally for 180 days. Use Cookie preferences below to withdraw; the page reloads and this integration’s cookies are cleared. Withdrawal cannot remove data already sent. Google’s privacy policy describes its processing. The intro also uses a small session-storage flag.

Site analytics events contain fixed page identifiers and query-free canonical URLs. Search measurement uses only exact full-query matches to a fixed reviewed skill vocabulary, with an unlisted bucket for all other text; it never sends the typed string. They exclude contact contents, unrestricted search words, complete outbound URLs, arbitrary user fields, and user IDs. Successful contact analytics records only that a submission was accepted, not confirmed email delivery. The local event log stays in page memory. Search words can appear in the address fragment and browser history. Contact submissions send your name, email, and message through Resend to Tradd. The site does not save a copy in browser storage. Resend and the receiving mailbox retain messages under their own service policies.

This describes the portfolio itself. Hosting and sign-in services may use their own storage and technical request logs.

Your analytics choice

See Google’s privacy policy.