A powerful browser extension for ABsmartly that enables visual editing of A/B test experiments. Create and manage DOM-based experiments without writing code.
- 🎨 Visual Editor: Select elements on any webpage and apply changes visually
- 🧪 Experiment Management: Create, edit, start, and stop experiments directly from the extension
- 🔍 Advanced Filtering: Filter experiments by state, significance, owners, tags, and more
- 💾 DOM Changes: Apply text, HTML, style, attribute, class, and JavaScript changes
- 🚀 SDK Integration: Works seamlessly with the ABsmartly JavaScript SDK
- 🌐 Multi-browser Support: Built with Plasmo framework for Chrome, Firefox, Edge, and Safari
- Clone the repository:
git clone https://github.com/absmartly/browser-extension.git
cd absmartly-browser-extension- Install dependencies:
pnpm install
# or
npm install- Run the development server:
pnpm dev
# or
npm run dev- Load the extension in your browser:
- Open Chrome/Edge and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
build/chrome-mv3-devdirectory
- Open Chrome/Edge and go to
pnpm build
# or
npm run buildThis creates production builds for all supported browsers in the build/ directory.
- Click the ABsmartly extension icon in your browser toolbar to open the sidebar
- In the sidebar, click the settings icon (⚙️)
- Enter your ABsmartly API credentials:
- API Key: Your ABsmartly API key (JWT or API key format)
- API Endpoint: Your ABsmartly API endpoint (e.g.,
https://demo.absmartly.com)
- Navigate to any webpage where you want to create an experiment
- Click the ABsmartly extension icon to toggle the sidebar on that page
- In the sidebar, click the paint brush icon (🎨) to open the visual editor
- Click "Start Selection" to begin selecting elements
- Click on any element on the page to select it
- Apply changes:
- Text: Change the text content
- Style: Add CSS properties
- Class: Add, remove, or toggle CSS classes
- Attribute: Set HTML attributes
- Click "Export Changes as JSON" to copy the changes
- Open the sidebar by clicking the ABsmartly extension icon
- In the sidebar, click the plus icon (➕) to create a new experiment
- Fill in the experiment details:
- Experiment name and display name
- Traffic percentage
- Unit type and primary metric
- Variants (minimum 2)
- For each variant, you can:
- Edit DOM changes manually
- Import changes from the visual editor
- Click "Create Experiment" to save
- Click the funnel icon (🔽) to expand filters
- Available filters:
- Search: Search by experiment name
- State: Filter by experiment state (running, stopped, etc.)
- Significance: Filter by result significance
- Issues: Filter by SRM, cleanup needed, etc.
- Applied filters show a badge with the count
The extension includes a companion SDK plugin for applying DOM changes on your website:
import { SDK } from '@absmartly/javascript-sdk';
import { createDOMChangesPlugin } from '@absmartly/dom-changes-plugin';
// Initialize ABsmartly SDK
const sdk = new SDK({
endpoint: 'https://your-endpoint.absmartly.com',
apiKey: 'your-api-key',
environment: 'production',
application: 'website'
});
// Create context
const context = sdk.createContext({
units: { userId: 'user-123' }
});
// Initialize DOM Changes plugin
const domPlugin = await createDOMChangesPlugin(context, {
debug: true,
observeDynamicContent: true
});DOM changes are stored as JSON in experiment variant variables:
[
{
"selector": ".hero-title",
"action": "text",
"value": "New Hero Title"
},
{
"selector": ".cta-button",
"action": "style",
"css": {
"background-color": "#28a745",
"font-size": "20px"
}
},
{
"selector": ".feature",
"action": "class",
"className": "highlighted",
"value": "add"
}
]- Sidebar (Injected UI): Main extension UI built with React and Tailwind CSS, injected into pages by the content script (
src/contents/sidebar.tsx) - Content Script: Injected into web pages for visual editing, SDK plugin initialization, and message relay (
content.ts) - Background Script: Handles messaging between the sidebar/content scripts and browser actions (
background.ts) - SDK Plugin: Injected helper to apply DOM changes on target websites (built artifact at
public/inject-sdk-plugin.jsand loader code undersrc/injection/)
absmartly-browser-extension/
├── content.ts # Main content script (visual editor, SDK injection, message relay)
├── src/contents/
│ └── sidebar.tsx # Injected sidebar UI
├── tabs/
│ └── sidebar.tsx # Plasmo tab entry used for sidebar rendering
├── background.ts # Background service worker
├── src/
│ ├── components/ # React components
│ ├── content/ # Visual editor and element picker
│ ├── contents/ # Content script UIs (e.g., sidebar)
│ ├── injection/ # SDK plugin loader and related code
│ ├── types/ # TypeScript types
│ └── utils/ # Helper functions
├── public/
│ └── inject-sdk-plugin.js # Injected DOM changes plugin bundle
└── style.css # Global styles
Playwright tests are under tests/. Use your package scripts to run the e2e test suite.
# Build extension
npm run build- ✅ Chrome/Chromium (Manifest V3)
- ✅ Microsoft Edge
- ✅ Firefox
- ✅ Safari (via Plasmo)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details