Integrate ABlyftTracking & events

Revenue tracking

Send order values to ABlyft and keep outliers from distorting your results.

A revenue goal measures money instead of a yes/no conversion, for example the order value. Your website sends the value with one JavaScript call. ABlyft then compares the revenue between variations.

Step 1: Create the goal in ABlyft

  1. Go to Targeting & Goals → Goals and create a goal.
  2. Choose the type Revenue ("Trigger a revenue value via JavaScript"). The measurement type is set to Value automatically.
  3. Check the API Name, for example purchase.
  4. Enter the Currency sign, for example €. It is required and used to display values.
  5. Optional: choose a Value filter type, see Value filters.
  6. In Statistic Settings, choose the counting method and winning direction, then save.
  7. Assign the goal to your experiment.

Step 2: Send the revenue

Call this on your order confirmation, with the real order value.

<script>
window['ablyft'] = window['ablyft'] || [];
window['ablyft'].push({
    eventType: 'revenue',
    eventName: 'purchase',
    eventValue: 49.9
});
</script>

All push parameters are listed in the push() reference. The eventName must match the API Name of the goal exactly, otherwise the call is ignored silently.

Use a number, not a string: 49.9, not "49,90 €". Send the same kind of value on every call (for example always the net or always the gross order value), and decide this before the experiment starts.

Take the value from your page

On a server-rendered page, print the value into the call:

<script>
window['ablyft'] = window['ablyft'] || [];
window['ablyft'].push({
    eventType: 'revenue',
    eventName: 'purchase',
    eventValue: 129.00 // output the order total here
});
</script>

With a data layer, read the value from the entry (here a GA4-style purchase event):

ablyftTools.watchDataLayerEntry('purchase', (entry) => {
  window.ablyft = window.ablyft || [];
  window.ablyft.push({
    eventType: 'revenue',
    eventName: 'purchase',
    eventValue: Number(entry.ecommerce.value)
  });
});

ablyftTools is available in the project JS code (Settings → Project Settings → Project Level Codes). See Custom JavaScript and Data layer events.

Counting method

Choose the counting method in the goal, see Counting method. With Every, a visitor with three orders contributes three values.

Avoid double counting

Make sure the call runs once per order. A confirmation page that is reloaded, or a data layer event that fires twice, would send the revenue twice when the counting method is Every. Protect the call, for example with a flag in sessionStorage for the order ID.

Value filters

A value filter caps outliers such as one very large order when results are calculated. Types, examples and effects are described in Value filters.

Check that it works

  1. Complete a test order in a preview of your experiment, with debug mode on. The console logs Triggered GOAL "<name>" (revenue).
  2. Check the Live Log of your project for the incoming event.
  3. Open the experiment results and compare the revenue with your shop system after some days. See Verify measurement.

Next steps

On this page