Repository navigation
Document how to target a feature flag to a URL - #22594
Conversation
Deploy preview
Changed pages
|
|
Vale prose linter → found 0 errors, 37 warnings, 6 suggestions in your markdown Full report → Copy the linter results into an LLM to batch-fix issues. Linter being weird? Update the rules!
|
| Line | Severity | Message | Rule |
|---|---|---|---|
| 11:234 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
| 17:45 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 21:63 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 38:170 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
| 70:63 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
| 75:30 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
| 76:19 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
| 76:49 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 82:107 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
| 84:32 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 96:36 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 113:147 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
| 139:64 | warning | 'dedup' is a possible misspelling. | PostHogBase.Spelling |
| 139:99 | warning | 'localStorage' is a possible misspelling. | PostHogBase.Spelling |
| 139:134 | warning | 'dedup' is a possible misspelling. | PostHogBase.Spelling |
| 145:5 | warning | 'Why SRM matters' heading should be in sentence case, and product names should be capitalized. | PostHogBase.SentenceCase |
| 176:5 | warning | 'What to do if SRM is detected' heading should be in sentence case, and product names should be capitalized. | PostHogBase.SentenceCase |
| 182:267 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 207:38 | warning | Capitalize 'Experiments' for PostHog's product. Use 'experiments' for the general industry concept. | PostHogBase.ProductNames |
contents/docs/feature-flags/evaluation-contexts.mdx — 0 errors, 10 warnings, 0 suggestions
| Line | Severity | Message | Rule |
|---|---|---|---|
| 13:75 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 28:9 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 42:69 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 43:21 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 44:13 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 44:37 | warning | Use 'API' instead of 'api'. | Vale.Terms |
| 45:17 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 60:64 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 161:237 | warning | Use the Oxford comma before 'and' or 'or' in a list of three or more items. | PostHogBase.OxfordComma |
| 167:16 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
contents/docs/feature-flags/property-overrides.mdx — 0 errors, 10 warnings, 4 suggestions
| Line | Severity | Message | Rule |
|---|---|---|---|
| 152:63 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 284:30 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 286:34 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 312:28 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 312:35 | warning | Use 'PostHog' instead of 'posthog'. | Vale.Terms |
| 312:43 | warning | Use 'iOS' instead of 'ios'. | Vale.Terms |
| 386:85 | warning | Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. | PostHogBase.ProductNames |
| 567:55 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 571:62 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
| 584:59 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 586:61 | warning | Don't put a comma after 'e.g.,'. Write 'i.e.' or 'e.g.' with no comma after it. | PostHogBase.LatinAbbreviationComma |
| 730:69 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
| 734:60 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
| 815:191 | suggestion | Address the reader directly. Use 'you' instead of 'the user'. | PostHogDocs.DirectAddress |
Bundle reportTotal JS (gzip)12.22 MiB (+5.4 KiB / +0.0%) Largest changed named chunks
Eager graph (modules shipped in each entrypoint's initial chunks)
Largest modules in the
|
| Module | Size |
|---|---|
css ./node_modules/.pnpm/css-loader@5.2.7_webpack@5.101.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/postcss-loader@4.3.0_postcss@8.5.6_webpack@5.101.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css |
1023.8 KiB |
./src/components/Stickers/Stickers.tsx |
696.4 KiB |
./node_modules/.pnpm/@posthog+brand@0.13.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/puzzle.mjs |
388.5 KiB |
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
354.8 KiB |
./node_modules/.pnpm/react-markdown@8.0.7_@types+react@16.14.66_react@18.3.1/node_modules/react-markdown/lib/react-markdown.js + 88 modules |
351.4 KiB |
./node_modules/.pnpm/@posthog+brand@0.13.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/basketball-coach.mjs |
337.4 KiB |
./node_modules/.pnpm/framer-motion@14.0.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs + 126 modules |
287.2 KiB |
./node_modules/.pnpm/cloudinary-core@2.14.0_lodash@4.17.21/node_modules/cloudinary-core/cloudinary-core.js |
281.9 KiB |
./src/components/SearchUI/index.tsx + 87 modules |
273.1 KiB |
./gatsby-browser.tsx + 60 modules |
259.6 KiB |
./node_modules/.pnpm/@posthog+brand@0.13.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/construction-1.mjs |
248.5 KiB |
./src/components/Pricing/PricingSlider/Slider.tsx + 87 modules |
240.2 KiB |
./node_modules/.pnpm/@posthog+brand@0.13.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/construction-2.mjs |
228.2 KiB |
./node_modules/.pnpm/@posthog+brand@0.13.0_react@18.3.1/node_modules/@posthog/brand/dist/generated/hoggies/svg/magnifying-glass.mjs |
221.7 KiB |
./src/hooks/useProduct.ts + 18 modules |
164.9 KiB |
Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes for the modules actually shipped in the entrypoint's initial chunks (post-tree-shake).
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 1826d88: 2 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
rubychilds
left a comment
There was a problem hiding this comment.
Overall, looks good. Not many suggestions!
|
|
||
| ## Targeting a specific URL | ||
|
|
||
| Feature flags don't have a setting that limits them to a page. PostHog evaluates flags when the SDK requests them, not when the user opens a page. To make a flag apply only on a specific page, use one of these options: |
There was a problem hiding this comment.
It's a little weird here to use 'Feature flags' then 'Posthog' like they are two separate entities.
"Feature flags do not have a setting that limits them to a page. Flags are evaluated when the SDK makes a request, not when the user opens up a page."
There was a problem hiding this comment.
Good catch. I reworded it to your suggestion: "Flags are evaluated when the SDK makes a request, not when the user opens a page, so they don't have a setting that limits them to a page." Fixed in 9523bca.
| "$pathname": pathname, | ||
| }, | ||
| ) | ||
| ``` |
There was a problem hiding this comment.
we are showing the passing here, but do we want to additionally add the getFlag functions here too? It's focused which is fine, but then it shows the full flow - as we mention passing in the next paragraph.
There was a problem hiding this comment.
Agreed, the examples now read the flag after evaluating it (getFlag in Node.js, get_flag in Python). Fixed in 9523bca.
| ### Exposing users on a specific page | ||
|
|
||
| To include only users who visit a specific page, set the exposure event to `$pageview` and add a property filter on `$pathname` (for example, `$pathname` equals `/pricing`) or `$current_url`. | ||
|
|
There was a problem hiding this comment.
Default exposure already works if you only read the flag on that page - should we state that?
There was a problem hiding this comment.
Good point. The section now opens by saying the default exposure works if only the target page reads the flag, and to use $pageview if other pages read it too. Fixed in 9523bca.
- property-overrides.mdx: the intro states that flags are evaluated per SDK request, and the server examples read the flag value - exposures.mdx: the page-exposure section says the default exposure works when only the target page reads the flag Claude-Session: https://claude.ai/code/session_01AovXvZeS9zrgxHYRjJ7dwM
Changes
Feature flags don't have a setting that limits a flag to one page. People ask for this in PostHog/posthog#32777. This PR documents the methods that work now.
The new "Targeting a specific URL" section in
feature-flags/property-overrideslists the methods. It gives details for three of them. You can check the URL in your code, send the URL withsetPersonPropertiesForFlags(), or send the URL to a server-side SDK as a person property. The other two pages link to this section and don't repeat it.The new section in
experiments/exposuressays to use a$pageviewexposure event with a filter on the page. It also says not to filter$feature_flag_calledby URL. The web SDK sends that event one time for each flag value. A user who first read the flag on a different page doesn't send it from the target page.The new use case in
feature-flags/evaluation-contextssets an evaluation context from the page path. It works only on sites where each page is a full page load.I loaded the three pages with
pnpm start. The console didn't show any new errors, and each new anchor link goes to its heading.pnpm formatdoesn't process.mdxfiles. The markdownlint pre-commit hook passed.Checklist
vercel.jsonhttps://claude.ai/code/session_01AovXvZeS9zrgxHYRjJ7dwM