1.1.3 • Published 7 months ago

svelte-split-testing v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Svelte Split Testing

npm version npm downloads bundle size

Run Split Tests (or A/B tests) with the power of Svelte(Kit). Split tests (or A/B tests) allow you to display different features or variants to test their effectiveness. Unfortunately popular options are very pricey, bloated, and don't work SSR. This package attempts to remedy all of that.

This package works with Svelte and SvelteKit.

  • Works SSR
  • Works with or without Kit
  • Works with GTM and GA4, or any other analytics solution
  • Lightweight
  • Free, of course

Demo and Docs: https://svelte-split-testing.playpilot.com/

Installation

Install using Yarn or NPM.

yarn add svelte-split-testing --dev
npm install svelte-split-testing --save-dev

Include the component in your app.

import { SplitTest } from "svelte-split-testing"
<SplitTest>...</SplitTest>

Configuration

For more configuration refer to the documentation: https://svelte-split-testing.playpilot.com/

Properties

This is a list of all configurable properties for each component and function.

SplitTest
PropertyDefaultDescription
key'Some Key'Key used to identify the current Split Test. This is primary used during analytics tracking.
variants'Variant A', 'Variant B'An array of variant names. Can be as many variants as you like. What the names are is not important, but they show up during analytics tracking.
onViewnullOptional function to be passed to track views of the current variant. Replaces the default GTM method.
serverGetSplitTestIdentifier
PropertyDefaultDescription
serverCookiesnullCookies object as served from +layout.server.js during SSR.
options{ userIdentifier, cookieName }Object of configurable options
options.userIdentifiernullAn optional user identifier to use as the identifier. This is used to show a user the same split test across different devices, as long as they have the same identifier. If an identifier was already set before the user identifierwas given the original cookie will be used instead. Be aware that this value will be saved in the cookie as a plain string. Do not use any data that you might not want to be public.
options.cookieName'splitTestIdentifier'The name of the cookie used to store the split testing identifier.
clientGetSplitTestIdentifier
PropertyDefaultDescription
options{ userIdentifier, cookieName }Object of configurable options
options.userIdentifiernullAn optional user identifier to use as the identifier. This is used to show a user the same split test across different devices, as long as they have the same identifier. If an identifier was already set before the user identifierwas given the original cookie will be used instead. Be aware that this value will be saved in the cookie as a plain string. Do not use any data that you might not want to be public.
options.cookieName'splitTestIdentifier'The name of the cookie used to store the split testing identifier.
1.1.1

7 months ago

1.1.3

7 months ago

1.1.0

8 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago