โš™๏ธWhat does the custom script do?

The custom Optibase script is a piece of JavaScript code that activates when a user loads a page on your website.

Firstly, the script makes a call to our server to check which tests are active and eligible.

Debug Mode

You can add ?optibaseEnableDebugMode at the end of the URL to permanently enable debug mode and see the console what the script is doing step by step. You can disable the debug mode by adding ?optibaseDisableDebugMode at the end of a URL.

Disabling Optibase Script

You can add ?optibaseDisableScript at the end of the URL to permanently disable tests for all pages on a domain for the current browser. No split tests will be run, the main variant will be always shown for all A/B tests and no conversion events will be sent. You can reenable tests by adding ?optibaseEnableScript at the end of a URL.

Split Tests

The script examines the URL the user is on and searches for any active and eligible split tests that use this URL as their entry variant. If it identifies such a split test, it determines whether to keep the user on the same page or redirect them to one of the other variants/pages.

In the event of a redirect, the script appends a `splitTestId` and `splitVariantId` search parameters to the redirect URL. This ensures clarity about the source of the redirect for the script on the redirect page.

A/B Tests

The script scans the website for elements tagged with both the data-optibase-test-id and data-optibase-variant-id attributes. It then matches these elements against the active and eligible tests in your account.

For each test, a random variant/element is chosen and displayed, while all other variants/elements for that test are removed from the page.

By default, your website should be set up so that all elements, except the primary one, are initially hidden using the inline style: style="display:none". The script reveals the randomly selected element by removing this style from it and removing all other elements.

Conversions

The script looks for elements on the website with either the data-optibase-click-conversion-id or data-optibase-submit-conversion-id attributes. It attaches click/submit listeners respectfully to these elements. When a visitor of your website triggers a listener, a Conversion Event is sent to the server for the current page involved in a split test and all selected elements in the A/B tests.

Page Views

After processing the tests, a Page View for the current page involved in a split test and all selected elements in the A/B tests is sent to the server. A Page View is not sent and not counted towards your monthly Page View limit if there are no active and eligible tests on the page.

Last updated