ABConvert Knowledge Base
  • Welcome to ABConvert
  • Getting started
    • ABConvert - Getting Started
    • ABConvert - How the Script Works
    • Use Cases
      • đź’°Price Test Use Cases
      • 📦Shipping Test Use Cases
      • đź§©Template Test Use Cases
      • 🎨Theme Test Use Cases
      • đź’łCheckout Test Use Case
      • đź”—URL Redirect Test Use Cases
      • ⚙️Advanced Options Use Cases
    • Best Practices
      • 🚦Test Design
  • Case Studies
    • How Smartwatchmagazijn Drove €10,000+ Monthly Growth Through A/B Testing
  • Price tests
    • Price Tests - Getting Started
    • Price Tests - How To Set Up
  • Shipping tests
    • Shipping Tests - Getting Started
    • Shipping Tests - How to Set Up
    • Shipping Tests - QA Checklist
    • Shipping Tests - Shipping Rates Mechanism
  • URL Redirect tests
    • URL Redirect Tests - Getting Started
    • URL Redirect Tests - How to Set Up
    • URL Redirect Tests - Trigger Conditions
  • URL Redirect Tests - QA Checklist
  • Template tests
    • Template Tests - Getting Started
    • Template Tests - How to Set Up
  • Theme tests
    • Theme Tests - Getting Started
    • Theme Tests - How to Set Up
  • Theme Tests - QA Checklist
  • Checkout tests
    • Checkout Tests - Getting Started
    • Checkout Tests - How to Set Up
  • Third Party App Integration
    • Third Party Integration List - Duplicate Variant Price Tests
    • Third Party Integration List - Cart Transform Price Tests
    • Page Builder Apps - Template Tests
  • Analytics
    • ABConvert Analytics Definition
    • Analytics Discrepancies
    • Statistical Significance Interpretation
  • More Resources
    • Changelog
    • FAQs
    • Submit User Feedback
  • Developer Resources
    • How to Access the A/B Test Group Index for Custom Code Injection
    • Shipping Test Event Listeners
Powered by GitBook
On this page
  • How It Works
  • Group Index Reference
  • Accessing the Test Group Index
  • startTime (included in some tests)
  1. Developer Resources

How to Access the A/B Test Group Index for Custom Code Injection

If you’d like to inject custom JavaScript or CSS into your A/B test variants, you can use the test group index stored in the browser’s localStorage to conditionally apply changes. This is useful for developers or advanced users who want to apply logic based on whether a visitor is in the control or test group.

How It Works

Our A/B testing script assigns visitors to a test group based on your test configuration and stores this information in the browser’s local storage. This value can be read and used in your custom scripts or styles.

Group Index Reference

Group Index
Description

0

Original group

1

Variant 1

2

Variant 2

3

Variant 3

4

Variant 4

Accessing the Test Group Index

You can read the test metadata from the browser’s localStorage. Each test stores data under a specific key and includes information like experimentId, groupIndex, and sometimes startTime.

Test type
Key
Value

Price test (cart transform)

abconvert-experiment-to-group-index

{ experimentId, groupIndex}

Price test (duplicate variant)

abconvert-price-test-experiment-to-group-index

{ experimentId, groupIndex}

Url redirect test

abconvert-url-redirect-test-${experimentId}

{ experimentId, groupIndex, startTime }

Template test

abconvert-template-test-${experimentId}

{ experimentId, groupIndex, startTime }

Theme test

abconvert-theme-test-${experimentId}

{ experimentId, groupIndex, startTime }

Delivery customization test

abconvert-delivery-customization-test-experiment-to-group-index

{ experimentId, groupIndex}

Payment customization test

abconvert-payment-customization-test-experiment-to-group-index

{ experimentId, groupIndex}

Checkout UI test

abconvert-checkout-ui-test-experiment-to-group-index

{ experimentId, groupIndex}

experimentId

This is the unique identifier of the test in our database. It helps track and differentiate between various experiments running on your store.

startTime (included in some tests)

The timestamp (in milliseconds) representing when the test started running on your store.

PreviousSubmit User FeedbackNextShipping Test Event Listeners

Last updated 12 days ago

For shipping test, please refer to .

Shipping Test Event Listeners