मुख्य सामग्री पर जाएँ
Skillpedia
एनालिसिस और स्प्रेडशीट41k · #6976

managing-path-cleaning-rules

यह क्या करती है

यह स्किल एजेंट को PostHog में वेब पेज पतों को साफ़ करने वाले नियम बनाना सिखाती है। यह उन साइट मालिकों के लिए है जिनकी रिपोर्ट हज़ारों लगभग एक जैसे पेज लिंक में बँटी हुई है।

कब इस्तेमाल करें

  • ✓जब आपके वेब एनालिटिक्स में एक ही पेज के कई संस्करण अलग-अलग ID के साथ दिखें।
  • ✓जब आप यूज़र प्रोफ़ाइल जैसे मिलते-जुलते पतों को एक पंक्ति में समूहित करना चाहें।
  • ✓जब आप पेज पते साफ़ करने वाले नियमों को टेस्ट या बदलना चाहें।

Skill का लिंक

https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/managing-path-cleaning-rules/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/PostHog/posthog/blob/master/products/web_analytics/skills/managing-path-cleaning-rules/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी रिपोर्ट में हर यूज़र प्रोफ़ाइल पेज की अलग पंक्ति दिखती है। क्या आप ऐसे नियम सेट कर सकते हैं कि वे सब एक पंक्ति में समूहित हों?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट असली पेज पतों को देखकर वे हिस्से ढूँढता है जो बदलते हैं, जैसे नंबर या ID। वह एक पैटर्न और पठनीय प्रतिस्थापन लिखता है, डेटा पर टेस्ट करता है, और नियमों को ऐसे क्रम में रखता है कि खास नियम पहले लागू हों।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Managing path cleaning rules

Path cleaning rules normalize $pathname and $entry_pathname so that pages sharing the same template (/users/123/profile, /users/456/profile, …) collapse into one row (/users/<id>/profile) in Web analytics tiles, Paths insights, and any HogQL query that calls apply_path_cleaning. They are the right answer when a breakdown is fragmented across thousands of near-identical URLs.

This skill teaches you how to:

  • recognize when path cleaning is the right tool
  • inspect real paths to find what needs cleaning
  • write regex + alias rules in re2 syntax with the project's placeholder convention
  • test rules before saving them
  • order rules so specific patterns aren't swallowed by generic ones
  • apply the rules via MCP

Data model

Team.path_cleaning_filters is a JSON list of PathCleaningFilter objects:

{
  "regex": "/users/\\d+/profile",
  "alias": "/users/<id>/profile",
  "order": 0
}
  • regex — a re2 pattern. No need to escape /. Anchor with ^ / $ when you mean it.
  • alias — the replacement. Default to angle-bracket placeholders (<id>, <slug>, <uuid>, <date>) so the cleaned path stays human-readable. Backreferences to the regex's capture groups also work, but they cost more to evaluate — see the backreference pitfall below before reaching for one.
  • order — integer. Rules apply sequentially in order ascending, each rule's output feeds the next.

Application is replaceRegexpAll(pathname, regex, alias) per rule, chained.

Workflow

1. Confirm path cleaning is the right move

Ask yourself: is the user complaining about cardinality (too many distinct paths in a chart), or do they want a per-URL drill-down? Path cleaning is for the former. If they want per-URL data, suggest a property filter on $pathname instead.

2. Inspect the real paths

Don't guess at patterns — query them. With the execute-sql MCP tool:

SELECT properties.$pathname AS path, count() AS views
FROM events
WHERE event = '$pageview'
  AND timestamp > now() - INTERVAL 7 DAY
GROUP BY path
ORDER BY views DESC
LIMIT 200

Scan the result for:

  • numeric IDs: /users/123, /orders/4242
  • UUIDs: /sessions/8f3c1a3b-…
  • slugs: /posts/why-i-love-posthog
  • dates: /archive/2024-09-12
  • locales: /en-US/, /fr-FR/
  • pagination: ?page=3, /page/3/

3. Draft regex + alias

Pattern Example match regex alias
Numeric segment /users/123/profile /users/\d+/profile /users/<id>/profile
UUID v4 /sessions/8f3c1a3b-… /sessions/[0-9a-f-]{36} /sessions/<uuid>
Slug /posts/why-posthog /posts/[a-z0-9-]+$ /posts/<slug>
ISO date /archive/2024-09-12 /archive/\d{4}-\d{2}-\d{2} /archive/<date>
Locale prefix /en-US/about ^/[a-z]{2}-[A-Z]{2}/ /<locale>/
Trailing query/page /blog?page=3 \?page=\d+$ (empty alias drops it)

Anchoring rules of thumb:

  • start the regex with ^ only when the segment must be at the beginning of the path
  • end with $ to keep a generic rule (e.g. \d+$) from matching mid-path segments

4. Test before saving

Three options, pick one:

  • Settings page tester: /settings/project#path_cleaning has a built-in "test path" input that replays the full ordered chain.

  • Project HogQL (via execute-sql):

    SELECT replaceRegexpAll('/users/42/profile', '/users/\d+/profile', '/users/<id>/profile')
    

    Chain replaceRegexpAll calls in the same order the rules will run if you want to verify multi-rule interaction.

  • Built-in AI helper: there is already an AiRegexHelper modal accessible from the rule editor (Help me with Regex button) that turns natural language into a regex. Suggest it to the user when they say "I don't know regex" — but always validate the output against real paths via the tester.

5. Order rules from most-specific to most-general

Sequential application means a generic rule placed first will swallow everything that should have hit a specific rule.

order=0  /users/me/profile        →  /users/me/pro
अक्सर पूछे जाने वाले सवाल

क्या साफ़ किए गए पते रिपोर्ट में दिखते हैं?

हाँ। साफ़ किया गया संस्करण उन रिपोर्ट और क्वेरी में दिखता है जो इन नियमों का उपयोग करती हैं।

id जैसे प्लेसहोल्डर कैसे दिखते हैं?

ये पठनीय लेबल होते हैं, जैसे id या slug, जो साफ़ किए गए पते में < > चिह्नों के भीतर दिखते हैं।

नियमों का क्रम क्यों मायने रखता है?

एक व्यापक नियम किसी खास नियम को निगल सकता है, इसलिए खास पैटर्न पहले रखे जाने चाहिए।

जानकारी

लेखक का मूल विवरण

Inspects URL paths and proposes, tests, orders, and applies project-level path cleaning rules so dynamic segments (numeric IDs, UUIDs, slugs, dates) collapse into readable aliases. Use when the user says "clean the paths", "normalize URLs", "group similar pages", "too many distinct paths", "/users/123 and /users/456 are the same page", "set up path cleaning", or asks why a Web analytics or Paths breakdown is fragmented across thousands of nearly-identical URLs. Covers regex syntax (re2), alias placeholder convention, rule ordering, the test workflow, and applying rules via the path-cleaning-ru

repo: PostHog/posthog

लोकप्रियता

GitHub स्टार
41k
रैंकिंग में स्थान
#6976
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

depot-ci

41k

यह आपके एजेंट को Depot CI वर्कफ़्लो सेट अप करने, चलाने और माइग्रेट करने में मदद करती है, साथ ही रन के लॉग पढ़ने में।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-container-builds

41k

यह आपके एजेंट को Depot के रिमोट बिल्डर पर Docker इमेज बनाने में मदद करती है, जिसमें मल्टी-प्लेटफ़ॉर्म इमेज और बिल्ड सुधार शामिल हैं।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

depot-github-runners

41k

यह आपके एजेंट को GitHub Actions जॉब Depot के मैनेज्ड रनर पर ले जाने, रनर का साइज़ और लेबल चुनने, और रनर सेटअप की समस्याएँ ठीक करने में मदद करती है।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

editing-agents-md

41k

यह आपके एजेंट को तय करने में मदद करती है कि कोई नियम AGENTS.md या CLAUDE.md में जाए या नहीं, और उसे ऐसे लिखे कि फ़ाइल भारी न हो।

AI और एजेंटएजेंट

मिलती-जुलती skills