stx-abtest
A simple web component for A/B testing chunks of code on your site.
Getting Started
- Include
stxabtest.js
in your HTML file
- via a script tag (quickest)
- or via a node module
npm install stx-abtest --save
Then add a script tag to your HTML like so:
<script src='node_modules/stx-abtest/dist/abtest.js></script>
- Add this tag to your HTML
<!-- Test A HTML goes here --> <!-- Test B HTML goes here -->
The component renders either the A or B case. NOTE: It actually adds both to the DOM but only shows one at random.
- Forcing a side
To force a side, either A or B then you can also provide the query param __side with a value of A or B.
e.g. http://example.com?__side=A
will render the A test all the time.
Working on stx-abtest
This component was built using stenciljs.com
To setup run:
npm installnpm start
To view the build, start an HTTP server inside of the /www
directory.
To watch for file changes during develop, run:
npm run dev
To build the app for production, run:
npm run build