Experiment Test page
Experiment Test Page
This page runs a live PostHog experiment on the section below. With full analytics consent, PostHog assigns you one of three versions; with limited analytics, you see the Control group. The links in each version switch between them.
The experiment
You are now viewing the Control group
Switch to Test group 1 or Test group 2.
You are now viewing Test group 1
Switch to the Control group or Test group 2.
You are now viewing Test group 2
Switch to the Control group or Test group 1.
The code running this test
The page loads PostHog Page Experiments, a free, MIT-licensed JavaScript package from 99Ways, and runs the code below. Test groups 1 and 2 start hidden, so you see the Control group until PostHog assigns a version. A query parameter named after the feature flag, as in the links above, sets the version instead.
<script src="https://cdn.jsdelivr.net/npm/@99ways/[email protected]/dist/posthog-page-experiments.min.js"></script>
<script>
window.runExperiment('001-about-page-Heading-test', {
variants: {
control: [],
test_group_1: [
{ selector: '#control-group', updates: { style: { display: 'none' } } },
{ selector: '#Heading-test1', updates: { style: { display: 'block' } } },
],
test_group_2: [
{ selector: '#control-group', updates: { style: { display: 'none' } } },
{ selector: '#Heading-test2', updates: { style: { display: 'block' } } },
],
},
}).catch(error => console.error('Experiment error:', error))
</script>