For the complete documentation index, see llms.txt. This page is also available as Markdown.

Klar

Send Elevate A/B Testing experiment and variation data into Klar by adding a snippet to your Klar custom pixel, so you can segment your Klar reporting by experiment.


The Klar integration sends your experiment and variation assignments into Klar, so every visitor in Klar carries the experiment they were part of and the variation they saw. You can then segment any Klar report by experiment without leaving Klar.

This is a one-time setup. You add a snippet to your Klar pixel once, and it covers every experiment you run from that point on. You do not repeat it per experiment.


What this does

Elevate A/B Testing writes each visitor's experiment assignments into cookies on your storefront. The snippet reads those cookies and pushes an AB group event into Klar for every experiment the visitor is currently in.

Elevate A/B Testing sends
Klar receives it as

Experiment name

experimentName

Variation name

variantName

A fixed project label

projectName, always EAB

The EAB project label is constant. It is how you identify Elevate A/B Testing data inside Klar and separate it from any other experimentation source you feed in.

What this does not do

  • It does not send your Elevate A/B Testing metrics into Klar. Klar measures visitors using Klar's own model. Your experiment results stay in Elevate A/B Testing.

  • It does not replace your experiment report. Use it to explore behaviour by segment, not to decide a winner.

  • Numbers in Klar will not match numbers in Elevate A/B Testing exactly. The two platforms count visitors and attribute orders differently. See Analytics Discrepancies.

Before you start

Requirement
Detail

A Klar account

With access to your Klar dashboard

A Klar Custom pixel in Shopify

This is the one you can edit. See the note below

Shopify admin access

To open Settings, then Customer events

Elevate A/B Testing installed and running

The snippet reads cookies that Elevate A/B Testing sets

Custom pixel, not the app pixel

Open Settings, then Customer events in your Shopify admin and look at your pixel list. You may see two Klar entries:

Pixel
Type
Can you edit it?

Klar

Custom

Yes. This is where the snippet goes

Klar Analytics

App

No. App pixels are managed by the app

The snippet has to go in a custom pixel, because app pixels cannot be edited. If you only have the Klar Analytics app pixel and no custom pixel, contact Klar about moving to a custom pixel implementation before you continue.

Set it up

Step 1: Copy the snippet

  1. In Elevate A/B Testing, open Integrations.

  2. Find the Klar card and open it.

  3. Select Copy on the code block at the top of Connect to Klar.

The full snippet is also below if you would rather take it from here.

Step 2: Open your Klar pixel in Shopify

  1. Go to your Shopify admin.

  2. Open Settings, then Customer events.

  3. Select your Klar pixel, the one listed with type Custom.

You should see the pixel implementation file with your existing Klar code in it.

Step 3: Paste the snippet

  1. Scroll to the bottom of the pixel implementation file.

  2. Paste the snippet after your existing Klar code, below the analytics.subscribe block.

  3. Save your changes.

Paste it at the bottom rather than in the middle. The snippet expects your Klar pixel to have already initialised, and it must sit inside the pixel's function scope.

Step 4: Enable the integration in Elevate A/B Testing

  1. Return to the Connect to Klar dialog in Elevate A/B Testing.

  2. Select Enable.

The snippet

How it works

The snippet reads three cookies that Elevate A/B Testing sets on your storefront:

Cookie
Holds

ABAU

Which experiments this visitor is currently active in

ABTL

Which variation this visitor was assigned in each experiment

ABRT

Experiment names and their variation names

For each experiment the visitor is active in, the snippet looks up the assigned variation, resolves both names, and pushes one AB group event to Klar. A visitor in three experiments produces three events, one per experiment.

If a visitor is in no experiments, nothing is sent. If a name cannot be resolved, the snippet sends Unknown Experiment or Unknown Variation rather than failing.

Verify it is working

  1. Open your storefront in a browser where you are enrolled in a running experiment. Use the preview tools in Elevate A/B Testing if you need to force an assignment.

  2. Open your browser console and confirm there are no errors mentioning AB test cookies.

  3. Open your Klar dashboard and look for AB group data under the EAB project.

Data will not appear in Klar instantly. Allow for Klar's normal processing delay before concluding something is wrong.


Troubleshooting

Nothing appears in Klar

Likely cause: No experiment was running when the visits happened, or the visitors were not enrolled.

How to confirm: Check that at least one experiment is in Running status, and confirm your own browser is enrolled by checking whether the variation is visible on the storefront.

Fix: Wait until a running experiment has real traffic. The snippet only fires for visitors who are actually assigned to an experiment.

The pixel editor rejects the code with a return statement error

Likely cause: The snippet was pasted outside the pixel's function scope.

How to confirm: Look at where you pasted it relative to the surrounding code. The snippet contains a return, which is only valid inside a function.

Fix: Paste it at the bottom of the pixel implementation file, inside the same function body as your existing Klar code, not after the closing brace.

The console shows an error parsing AB test cookies

Likely cause: A cookie was truncated or malformed.

How to confirm: The error message begins with Error parsing AB test cookies.

Fix: Clear cookies for your storefront and reload with an experiment running. If it repeats consistently across browsers, contact support with the console output.

Klar shows Unknown Experiment or Unknown Variation

Likely cause: The ABRT cookie did not contain the name for that experiment or variation when the event fired.

How to confirm: Check whether the affected experiment was renamed, started, or ended around the time those events were recorded.

Fix: Cookies refresh on the visitor's next page load. New sessions should resolve correctly. Historical events already sent to Klar keep the value they were sent with.

I cannot find where to paste the code

Likely cause: You are looking at the Klar Analytics app pixel rather than a custom pixel.

How to confirm: In Settings, then Customer events, check the Type column. App pixels cannot be edited.

Fix: Use the Klar pixel listed as Custom. If you do not have one, contact Klar.

Klar numbers do not match my Elevate A/B Testing report

Likely cause: Expected. The two platforms count visitors and attribute orders differently.

Fix: Use Elevate A/B Testing for deciding the experiment and Klar for exploring behaviour. See Analytics Discrepancies.


FAQs

Do I need to add this snippet for every experiment?

No. Add it once. It covers every experiment you run afterwards, automatically.

What happens to the snippet when an experiment ends?

Nothing. The visitor stops being active in that experiment, so the snippet stops sending events for it. Leave the code in place.

Does this work with Personalizations as well as experiments?

[NEEDS VERIFICATION: whether Personalization assignments are written to the same cookies and therefore picked up by this snippet.]

Does this slow down my store?

The snippet reads cookies and pushes to an array already on the page. It makes no network request of its own. It runs inside your Klar pixel, which Shopify loads asynchronously.

Can I change the project name from EAB?

The value is hardcoded in the snippet. [NEEDS VERIFICATION: whether editing it is supported or whether Elevate A/B Testing expects the literal EAB value elsewhere.]

What if I run experiments from more than one tool?

The EAB project label separates Elevate A/B Testing data from other sources inside Klar.


Next steps

Last updated