Build

Measure your own widget

On this page

Built your own widget instead of using AndOr’s? Your design can still use AndOr’s numbers. You keep your markup and your add to cart. AndOr counts the results.

What you get

  • Discount results, with any widget. When a shopper uses an AndOr discount, AndOr counts it from your store’s orders. That works with any add to cart, your theme’s own included. Nothing to add.
  • Orders and revenue, credited to an offer. Mark the lines your widget adds with an AndOr upsell offer’s ID. AndOr then credits those orders to that offer, the same as its own widgets. You see orders, revenue and the offer’s row in the tables.

The offer can be any upsell offer you already have, for example a Bundle offer. No special type is needed.

Credit orders to an offer

  1. Copy the offer ID.

    Open the offer in AndOr and copy its ID from the offer page.

  2. Add it to your add to cart as a line property.

    Set the property _andor_offer_id to the offer’s ID on every line your widget adds.

    With JavaScript:

    await fetch('/cart/add.js', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        items: [{
          id: variantId,
          quantity: 1,
          properties: { _andor_offer_id: 'OFFER_ID' },
        }],
      }),
    });
    JavaScript

    In a product form:

    <input type="hidden" name="properties[_andor_offer_id]" value="OFFER_ID">
    HTML

    Replace OFFER_ID with the ID you copied.

  3. Place a test order.

    Order numbers show in AndOr within a day.

Shopify hides line properties that start with an underscore at checkout. See The _andor_offer_id line property.

Not covered yet

  • Views and adds for your own widgets: coming soon. AndOr counts views, clicks and adds only for its own widgets today.

Where to see the numbers

  • The offer’s row in By upsell offer on the Analytics page.
  • The offer’s details on the Upsell offers tab.

See Analytics overview and How we count.

Next steps

Last updated

Was this page helpful?

No

Questions? Email andor@backtrackhq.com or use the chat in the app.