Conversion tracking

When a shopper reaches the order confirmation page, Solidshop can tell your analytics and advertising tools that an order was placed. The order is published once, on that page only, with its amounts, products and currency — and with no personal data. Nothing is sent from your server: the page hands the order to the browser, and the tools you run there pick it up.

The core ships the neutral layer every tag manager reads. The connectors that send the order straight to Google, Meta, Microsoft, TikTok, Matomo, Plausible, Umami or Fathom from an ID are the Conversion Tracking plugin, whose settings join the same Tracking tab.

Turning it on

Open your store (Solidshop → Configuration → Stores) and the General card of its Tracking tab:

Setting What it does
Publish orders to the data layer On the confirmation page, pushes the order to window.dataLayer as a GA4 ecommerce purchase and fires a solidshop:purchase event in the browser. Off by default: turn it on when you run Google Tag Manager or a script of your own. A store with nothing to read it adds nothing to the page.
Count orders not yet paid On by default. A bank transfer or cash-on-delivery order is still Pending on the confirmation page, and so is an off-site payment whose confirmation has not arrived yet. These orders are reported with paid: false. Switched off, only paid, part-paid and authorised orders are reported — and a store that sells on bank transfer counts no sales at all.

Orders that were voided (the payment never started, or failed or was cancelled at the provider), cancelled or refunded are never reported. The settings belong to the store, so on a site with several stores each reports to its own tools.

Google Tag Manager

The push follows GA4’s ecommerce shape, so a GA4 tag in Tag Manager needs no mapping:

  1. Create a Custom Event trigger with the event name purchase.
  2. Add a Google Analytics: GA4 Event tag on that trigger, with the event name purchase, Send Ecommerce data on and Data Layer as the source.
  3. For a Google Ads conversion, read the amount from the Data Layer Variable solidshop.total (what the customer paid) and the order id from ecommerce.transaction_id.

To report only orders with money taken while keeping the store setting on, add a Data Layer Variable solidshop.solidshop.paid and a condition that it equals true to the trigger. The push carries the order under solidshop, and the order keeps its payment facts in a solidshop block of its own, hence the name twice. An authorised or part-paid order carries false too.

What the event contains

Two shapes are published for one order. The ecommerce object is GA4’s: transaction_id, value (goods after discounts, before tax and shipping), tax, shipping, currency, coupon, affiliation (the store’s name) and items, each with item_id (the SKU, else the product id), item_name, item_variant, item_category, item_brand, price, quantity and discount.

The solidshop object is the same order in the field names customer data platforms use (Segment’s “Order Completed”), and it is the detail of the solidshop:purchase browser event:

{
  "order_id": "SS-000123",
  "affiliation": "Northwind Store",
  "revenue": 95.00,
  "subtotal": 95.00,
  "shipping": 8.00,
  "tax": 20.60,
  "discount": 10.00,
  "coupon": "WELCOME10",
  "currency": "EUR",
  "total": 123.60,
  "products": [
    { "product_id": "17", "sku": "TS-RED-M", "name": "Classic Tee", "variant": "Red / M",
      "category": "Clothing", "brand": "Northwind", "price": 25.00, "quantity": 2 },
    { "product_id": "23", "sku": "TOTE-01", "name": "Canvas Tote", "category": "Bags",
      "brand": "Northwind", "price": 45.00, "quantity": 1, "discount": 10.00 }
  ],
  "solidshop": {
    "schema": 1, "store_id": 1, "payment_method": "stripe",
    "payment_status": "paid", "paid": true, "customer_type": "new"
  }
}

revenue is the goods after discounts, before tax and without shipping — the value GA4 expects and the figure the sales report shows. total is what the customer paid, including shipping, tax and any payment fee; it is the amount ad platforms want. The amounts are taken from the order itself, so they match the order screen to the cent whichever way the store prices its tax. A product’s price is its unit price after any discount on the line, and discount, present only when there is one, is that discount per unit.

The event never carries a name, e-mail address, phone number, address or account id. customer_type (new or returning; empty when the order has neither an account nor an e-mail address) is the one fact about the customer. The shape is versioned by schema, and a field is only ever added.

Your own script

Any script on the page can listen for the order. The event is cancelable: a listener that calls preventDefault() takes the order over: the data layer push is skipped, and so are the Conversion Tracking plugin’s tools and custom code.

window.addEventListener('solidshop:purchase', function (event) {
    var order = event.detail;
    // order.order_id, order.total, order.currency, order.products ...
});

A script that may load after the page has published (a consent tool running it later, for instance) can ask for the orders already published:

window.SolidshopConversions.subscribe(function (order, info) {
    if (!info.vetoed) { /* ... */ }
});

The page publishes each order once per browser tab, so a reload does not publish it again. subscribe() calls your function for each order every time your script runs, so a script that a consent tool may run twice should keep its own note of the orders it has sent.

For extension developers

A plugin gets the same order on the server from the onSolidshopOrderConfirmation event, fired once for each reported order while the confirmation page renders. getOrderEvent() returns the order as above and getGa4() its ecommerce object, so there is no need to query the order again. requestPublisher() puts the browser side on the page even with Publish orders to the data layer off: the page then fires solidshop:purchase but pushes nothing to the data layer. addConnector() hands settings to a connector script your plugin loads. A listener that throws is logged, and the page still renders.

Consent

The data layer push and the browser event send nothing and set no cookie (the page keeps only a per-tab note in session storage that the order was published), so they need no consent. The tags you run on them do: use the site’s cookie banner, or let your tag manager gate the tags itself.