A/B Testing SDK Documentation
Everything you need to integrate Otter A/B. SDK reference, REST API, event tracking, and core concepts.
Quick Start
Add this snippet to your website's <head> tag to get started.
<!-- Otter A/B Testing -->
<style id="optimo-hide">body{opacity:0 !important}</style>
<script src="https://www.otterab.com/sdk/optimo.js"
key="YOUR_API_KEY" async></script>Integration Guides
Otter A/B runs on the same lightweight SDK, but setup looks a little different depending on how your site is deployed. Pick the guide that matches your platform and Otter A/B will tailor the installation steps after project creation.
Custom JavaScript
Site <head>
Paste the Otter A/B snippet into the <head> of any site you control.
Shopify
theme.liquid + Customer events
Use the Shopify theme snippet and custom pixel to install Otter A/B and track commerce events.
WordPress
Header / footer plugin
Install Otter A/B in WordPress via a header and footer plugin such as WPCode.
Webflow
Project Settings > Custom Code
Add Otter A/B in Webflow Project Settings under Custom Code.
Wix
Settings > Custom Code
Use Wix Marketing Integrations or Custom Code to add Otter A/B to your site head.
WooCommerce
WordPress plugin + event helpers
Use the WordPress install flow, then wire Otter A/B into WooCommerce add-to-cart and purchase events.
ClickFunnels
Page / funnel header code
Use ClickFunnels header tracking code to install Otter A/B on the pages you want to test.
Squarespace
Settings > Advanced > Code Injection
Install Otter A/B in Squarespace using Settings > Advanced > Code Injection.
Framer
Site settings > Custom code
Paste the Otter A/B snippet into Framer site settings to load it on every page.
Next.js
app/layout.tsx or _document.tsx
Install Otter A/B in Next.js via `app/layout.tsx` or `_document.tsx` depending on your app structure.
Google Tag Manager
GTM Custom HTML tag
Use a GTM Custom HTML tag with an all-pages trigger to load Otter A/B site-wide.
SDK API Reference
The Otter A/B SDK exposes a global optimo object with the following methods.
// Track a custom event
optimo.track("signup_complete", {
plan: "pro",
source: "landing_page"
});
// Track revenue
optimo.revenue({
value: 49.99,
currency: "USD",
order_id: "order_123"
});REST API
The SDK communicates with these endpoints. You can also call them directly for server-side integrations.
| Method | Endpoint | Description |
|---|---|---|
| POST | /sdk/init | Initialize visitor, get test config |
| POST | /sdk/track | Track custom events |
| POST | /sdk/convert | Record conversions |
| POST | /sdk/identify | Send user properties |
| GET | /sdk/active/:key | Verify snippet installation |
Concepts
Key ideas behind how Otter A/B works.
Variant Assignment
Otter A/B uses deterministic hashing based on visitor ID and test ID to seed assignments, then persists sticky assignments server-side so a visitor keeps the same variant across sessions.
Statistical Significance
Results are evaluated with the analysis method you choose. Frequentist mode uses Fisher's exact test when conversion counts are sparse, otherwise a two-proportion z-test for conversion rates, plus Welch's t-test for revenue metrics. Bayesian mode estimates the probability that a variant beats the control.
Anti-Flicker
The anti-flicker snippet hides the page body (opacity: 0) until variants are applied. The SDK applies cached variants synchronously when possible. A 3-second failsafe guarantees the page becomes visible even if the SDK fails to load.