PostHog / posthog-js

Send usage data from your web app or site to PostHog, with autocapture.
https://posthog.com/docs/libraries/js
Other
278 stars 114 forks source link

feat(experiments): Apply no-code experiments to the webpage. #1409

Closed Phanatic closed 2 weeks ago

Phanatic commented 2 weeks ago

Changes

This PR introduces a new extension to posthog-js called web-experiments which allows posthog to apply no-code experiments to elements on a web page. This PR needs https://github.com/PostHog/posthog/pull/24872 to merge so it can function.

To enable this feature, developers have to opt-in by setting disable_web_experiments to false in posthog.init while in Beta.

There are multiple ways to target an experiment within the browser here :

  1. Current URL can be matched with exact, contains, not_contains, regex, not_regex
  2. UTM targeting works by parsing the Current URL and evaluating conditions on individual variants.

Checklist

Coming up in following PRs

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 13, 2024 6:59pm
github-actions[bot] commented 2 weeks ago

Size Change: +19.8 kB (+1.67%)

Total Size: 1.21 MB

Filename Size Change
dist/array.full.js 346 kB +4.96 kB (+1.45%)
dist/array.js 162 kB +4.95 kB (+3.15%)
dist/main.js 163 kB +4.95 kB (+3.14%)
dist/module.js 162 kB +4.95 kB (+3.15%)
ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `dist/exception-autocapture.js` | 10.4 kB | | `dist/recorder-v2.js` | 110 kB | | `dist/recorder.js` | 111 kB | | `dist/surveys-preview.js` | 59.8 kB | | `dist/surveys.js` | 66 kB | | `dist/tracing-headers.js` | 8.26 kB | | `dist/web-vitals.js` | 10.3 kB |

compressed-size-action