Optimize - A/B Testing PlatformOptimize
Docs Pricing Dashboard

Documentation

Getting Started

1. Sign up for an account and get your API key from the dashboard.

2. Add the SDK to your site:

<script src="https://optimize.netwrck.com/sdk.js" data-optimize-key="YOUR_API_KEY"></script>

Creating Experiments

Create experiments via the dashboard or API:

curl -X POST https://optimize.netwrck.com/api/experiments \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "CTA Test", "variants": ["control", "variant_a", "variant_b"]}'

JavaScript SDK

Get Variant

optimize.getVariant(experimentId, function(variant) { console.log('Assigned to:', variant); });

Track Conversion

optimize.convert(experimentId, value, goalName);

DOM Changes

optimize.activate(experimentId, { 'variant_a': { '.headline': { text: 'New Headline' }, '.cta': { style: { backgroundColor: 'green' } } } });

AI Personalization

Neural contextual bandits that learn which content converts best for each user segment in real-time.

Get Personalized Ranking

Rank actions based on user context. Returns actions sorted by predicted conversion probability:

optimize.personalize('hero-cta', { context: { device: 'mobile', referrer: 'google', returning_user: true }, actions: [ { id: 'free-trial', features: { urgency: 'low' } }, { id: 'book-demo', features: { urgency: 'high' } }, { id: 'see-pricing', features: { urgency: 'medium' } } ] }, function(result) { // result.ranking = actions sorted by probability // result.event_id = use for reward tracking showCTA(result.ranking[0]); });

Send Reward Signal

When the user converts, send a reward to train the model:

// After user clicks CTA or converts optimize.personalizeReward(eventId, 1.0); // Or use the last personalization event automatically optimize.personalizeReward(null, 1.0);

Quick Helper: Get Best Action

optimize.getBestAction('hero-cta', context, actions, function(bestAction, eventId) { displayAction(bestAction); // Track when user converts button.onclick = function() { optimize.personalizeReward(eventId, 1); }; });

Auto-Reward on Click

// Automatically send reward when user clicks any matching element optimize.autoReward('.cta-button', 1.0);

Multi-Armed Bandits

For automatic optimization using Thompson Sampling:

// Get best arm optimize.selectArm(banditId, function(arm) { showVariant(arm); }); // Record reward (e.g., on conversion) optimize.reward(banditId, 1);

Shopify Integration

Optimize provides first-class Shopify support with automatic add-to-cart tracking, purchase tracking, and specialized A/B testing helpers.

Installation

Add the SDK to your theme.liquid file, just before the closing </head> tag:

<script src="https://optimize.netwrck.com/sdk.js" data-optimize-key="YOUR_API_KEY"></script> <script> // Initialize Shopify integration document.addEventListener('DOMContentLoaded', function() { optimize.initShopify(); }); </script>

Automatic Tracking

Once initialized, Optimize automatically tracks:

  • Add to Cart - Intercepted via AJAX (both fetch and jQuery)
  • Checkout Start - When user clicks checkout button
  • Page Context - Product type, collection, and page type

A/B Test Add-to-Cart Button

optimize.testAddToCart(experimentId, { 'variant_a': { text: 'Add to Cart', style: { backgroundColor: '#000' } }, 'variant_b': { text: 'Buy Now - Free Shipping!', style: { backgroundColor: '#22c55e', fontWeight: 'bold' } } });

A/B Test Product Page Elements

// Test with product context automatically included optimize.testProduct(experimentId, { 'variant_a': { '.product-title': { style: { fontSize: '28px' } } }, 'variant_b': { '.product-title': { style: { fontSize: '36px', color: '#1a1a1a' } }, '.product-badge': { text: 'BEST SELLER', show: true } } });

Test Price Display

optimize.testPrice(experimentId, { 'variant_a': { format: '${price}' }, 'variant_b': { format: 'Only ${price} - Save 20%!', style: { color: '#dc2626', fontWeight: 'bold' } } });

Track Purchases (Thank You Page)

Add this to your checkout thank you page (or use Shopify's Additional Scripts):

<script> // Shopify provides order data on thank you page {% if first_time_accessed %} optimize.trackPurchase({ total_price: {{ checkout.total_price }}, order_id: '{{ order.name }}' }); {% endif %} </script>

Custom Add-to-Cart Tracking

If you need manual control over tracking:

// Manual add to cart tracking optimize.trackAddToCart({ price: 2999, // price in cents product_id: '12345' }); // Get current cart data optimize.getCart(function(cart) { console.log('Cart total:', cart.total_price / 100); });

Listen for Events

// Listen for add to cart events document.addEventListener('optimize:addtocart', function(e) { console.log('Product added:', e.detail); });

REST API

Endpoints

  • POST /api/experiments - Create experiment
  • GET /api/experiments - List experiments
  • GET /api/stats/{id} - Get experiment stats
  • POST /api/decide - Get variant assignment
  • POST /api/convert - Track conversion
  • POST /api/track - Track custom event

Authentication

Include your API key in the X-API-Key header or as api_key query parameter.

Statistical Significance

We use a two-proportion z-test to determine statistical significance at 95% confidence. Results show:

  • Conversion rate per variant
  • P-value and z-score
  • Confidence level
  • Required sample size estimate
  • Winner declaration when significant
© 2025 NetWRCK
Privacy Terms Docs