Kim Svatos Dugan 444db7516d feat(replay): create new synthetic playlist for newly detected URL (#40895)
## Problem

We want to detect when a "new" url is seen, create a collection out of it, and (later PR) send a notification in the weekly digest about this new URL

I went back and forth on some decisions, but heres where they stand rn: 
1. "New URLS": havent been seen in 90 days. Made this decision because I was worried about the performance of checking all URLs in perpetuity -- also, seems semi reasonable, if a URL isnt seen for 3 months then is seen again, thats still interesting? 
2. Pattern matching: I was worried about params as part of URLs, so we do some regex stuff to try and group URLs together into one playlist when the only difference is a id/uuid/hash as part of a url (ie, /settings/2 will be grouped with settings/3) 
3. LIMITs / short circuits: again seemed a semi-sensible tradeoff on exact accuracy vs performance

## Changes

1. defined new synthetic playlist source `NewUrlsSyntheticPlaylistSource() `
2. This playlist source can actually return multiple playlists (one per new URL)
3. 2 caches -- normalized_url -> count (for list display), and normalized_url -> list of session ids (for populating the collection when a user clicks into it) 
4. when user clicks on a collection to watch, use URL hash to lookup session IDs for that collection in the cache
4. do lots of URL normalizing/pattern matching / logic to ensure we're grouping URLs together, and only showing URLS first seen in the last 14 days (and not otherwise within the last 90 days) 
5. limit this to 20 playlists/urls
3. gate all this behind a flag
## How did you test this code?

had claude help write lots of date-checking and url-pattern-matching tests
test shows me locally running a helper (to clear cache, offscreen) before refreshing, see a ~3-4 second cold load time

[Screen Recording 2025-11-04 at 11.22.01 AM.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/user-attachments/thumbnails/f8803d5d-c241-4c8b-91f4-ee00b0a06394.mov" />](https://app.graphite.dev/user-attachments/video/f8803d5d-c241-4c8b-91f4-ee00b0a06394.mov)


<!-- Docs reminder: If this change requires updated docs, please do that! Engineers are the primary people responsible for their documentation. 🙌 -->

👉 _Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review._

## Changelog: (features only) Is this feature complete?

<!-- Optional, but helpful for our content team! -->
<!-- Yes if this is okay to go in the changelog. No if it's still hidden behind a feature flag, or part of a feature that's not complete yet, etc.  -->
2025-11-05 12:29:20 -08:00
2020-01-24 16:22:12 -08:00
2021-11-09 07:59:21 +00:00
2023-11-20 08:18:29 +01:00
2025-10-31 17:41:35 +01:00
2025-05-18 20:30:42 +01:00
2024-04-19 14:19:10 +02:00
2025-10-31 10:23:54 +01:00
2025-07-23 13:14:20 +01:00

posthoglogo

GitHub contributors PRs Welcome Docker Pulls GitHub commit activity GitHub closed issues

Docs - Community - Roadmap - Why PostHog? - Changelog - Bug reports

PostHog Demonstration

PostHog is an all-in-one, open source platform for building successful products

PostHog provides every tool you need to build a successful product including:

  • Product analytics: Autocapture or manually instrument event-based analytics to understand user behavior and analyze data with visualization or SQL.
  • Web analytics: Monitor web traffic and user sessions with a GA-like dashboard. Easily monitor conversion, web vitals, and revenue.
  • Session replays: Watch real user sessions of interactions with your website or mobile app to diagnose issues and understand user behavior.
  • Feature flags: Safely roll out features to select users or cohorts with feature flags.
  • Experiments: Test changes and measure their statistical impact on goal metrics. Set up experiments with no-code too.
  • Error tracking: Track errors, get alerts, and resolve issues to improve your product.
  • Surveys: Ask anything with our collection of no-code survey templates, or build custom surveys with our survey builder.
  • Data warehouse: Sync data from external tools like Stripe, Hubspot, your data warehouse, and more. Query it alongside your product data.
  • Data pipelines: Run custom filters and transformations on your incoming data. Send it to 25+ tools or any webhook in real time or batch export large amounts to your warehouse.
  • LLM analytics: Capture traces, generations, latency, and cost for your LLM-powered app.

Best of all, all of this is free to use with a generous monthly free tier for each product. Get started by signing up for PostHog Cloud US or PostHog Cloud EU.

Table of Contents

Getting started with PostHog

The fastest and most reliable way to get started with PostHog is signing up for free to PostHog Cloud or PostHog Cloud EU. Your first 1 million events, 5k recordings, 1M flag requests, 100k exceptions, and 1500 survey responses are free every month, after which you pay based on usage.

Self-hosting the open-source hobby deploy (Advanced)

If you want to self-host PostHog, you can deploy a hobby instance in one line on Linux with Docker (recommended 4GB memory):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"

Open source deployments should scale to approximately 100k events per month, after which we recommend migrating to a PostHog Cloud.

We do not provide customer support or offer guarantees for open source deployments. See our self-hosting docs, troubleshooting guide, and disclaimer for more info.

Setting up PostHog

Once you've got a PostHog instance, you can set it up by installing our JavaScript web snippet, one of our SDKs, or by using our API.

We have SDKs and libraries for popular languages and frameworks like:

Frontend Mobile Backend
JavaScript React Native Python
Next.js Android Node
React iOS PHP
Vue Flutter Ruby

Beyond this, we have docs and guides for Go, .NET/C#, Django, Angular, WordPress, Webflow, and more.

Once you've installed PostHog, see our product docs for more information on how to set up product analytics, web analytics, session replays, feature flags, experiments, error tracking, surveys, data warehouse, and more.

Learning more about PostHog

Our code isn't the only thing that's open source 😳. We also open source our company handbook which details our strategy, ways of working, and processes.

Curious about how to make the most of PostHog? We wrote a guide to winning with PostHog which walks you through the basics of measuring activation, tracking retention, and capturing revenue.

Contributing

We <3 contributions big and small:

Open-source vs. paid

This repo is available under the MIT expat license, except for the ee directory (which has its license here) if applicable.

Need absolutely 💯% FOSS? Check out our posthog-foss repository, which is purged of all proprietary code and features.

The pricing for our paid plan is completely transparent and available on our pricing page.

We're hiring!

Hedgehog working on a Mission Control Center

Hey! If you're reading this, you've proven yourself as a dedicated README reader.

You might also make a great addition to our team. We're growing fast and would love for you to join us.

Description
No description provided
Readme MIT 2.4 GiB
Languages
Python 47%
TypeScript 38.6%
JavaScript 6.7%
Rust 5.7%
C++ 0.9%
Other 0.9%