Plugins
Connect Abrantes with analytics and tools you already use.
Plugin basics
- Use
AbrantesPlus.min.jsto load Abrantes and all the default plugins in one file. - Or load individual plugin files after
Abrantes.js. - Call plugin methods after
assignVariant. - Customize plugin settings through
Abrantes.settingsor your object settings. - Some plugins share method names (for example, GA4 and Matomo both use
track).
Available plugins
Seeded experiment
Allows cookieless experiments and powers cross-device experiments with logged in users.
seed = JSON.stringify(userData);
await MyTest.assignSeededVariant("MyTest", seed, 1, () => true);
Open example →Open source code →
GTM dataLayer
Push test and variant info into dataLayer for Google Tag Manager.
MyTest.add2dataLayer("example_test");
Customize fields in Abrantes.settings.dataLayer. Requires dataLayer
to be initialized.
Open source code →
Abrantes log
Send events to the Abrantes log API.
MyTest.log("button_click", "User clicked the log button");
Configure log apiURL with MyTest.settings.log.apiURL.
Open source code →
Open API project →
Form tracking
Fill a hidden input with the test and variant for CRM or lead forms.
<input type="hidden" id="last_abtest_variant">
MyTest.formTrack();
Set the selector in Abrantes.settings.formTrack.inputElement.
Open source code →
GA4 (gtag)
Track events or user properties in Google Analytics 4 using gtag.js.
- Requires
gtagand awindow.googleTrackingConfigobject.
Call gtag("config", "G-XXXX", window.googleTrackingConfig) after setting it.
MyTest.track("test_event");
MyTest.trackUser("test_user");
Open example →Open source code →
Hotjar
Trigger Hotjar events based on the assigned variant.
- Uses
hjif present, or waits for cookie events.
MyTest.hotjar();
Configure triggers with Abrantes.settings.hotjar.triggerEvents.
Open source code →
Microsoft Clarity
Set Clarity dimensions with the test and variant.
MyTest.clarity();
Configure triggers with Abrantes.settings.clarity.triggerEvents.
Open source code →
Matomo
Store the variant in a Matomo custom dimension.
MyTest.track(3);
Requires _paq to be initialized. Pass the custom dimension ID.
Open source code →
Hubspot enterprise
Trigger a custom event in Hubspot Enterprise.
MyTest.hubspotEvent("pe5361482_run_ab_test");
You need to create the custom event in the Hubspot dashboard to get the event ID before using it.
Open example →Open source code →