Install guide

Install with a script tag

One line of HTML on every page. Two optional calls make it smarter: the basket for placement rules, and the order for your reports.

Steps

  1. Add the snippet before </body>

    Put it on every page, usually in your site's footer template. Use your test key while you try it, and your live key when you go live.

    Every page
    <script async src="https://vouchernaut.com/embed/v1/widget.js" data-key="vn_pk_live_…"></script>
  2. Pass the basket (optional)

    Placement rules can use the basket's value and products. Call setCart whenever it changes, in pounds and pence as you'd show them (major units). If your site already sends GA4 view_cart or add_to_cart events to the dataLayer, the widget reads those and you can skip this.

    On basket changes
    <script>
    window.VouchernautReady = window.VouchernautReady || [];
    window.VouchernautReady.push(function (vn) {
      vn.setCart({
        "value": 54.98,
        "currency": "GBP",
        "items": [
          {
            "sku": "TEE-BLACK-M",
            "qty": 2,
            "price": 27.49
          }
        ]
      });
    });
    </script>
  3. Send each order (optional)

    On your order confirmation page, track("order") reports the order and the codes used, so your reports show sales and revenue. Each order id is sent once, however often the page renders.

    Order confirmation page
    <script>
    window.VouchernautReady = window.VouchernautReady || [];
    window.VouchernautReady.push(function (vn) {
      vn.track("order", {
        "id": "10492",
        "total": 54.98,
        "currency": "GBP",
        "codes": [
          "STUDENT10"
        ],
        "items": [
          {
            "sku": "TEE-BLACK-M",
            "qty": 2,
            "price": 27.49
          }
        ]
      });
    });
    </script>
  4. Allow the widget in your Content-Security-Policy

    Only if your site sends a CSP header: add these to the directives you already have.

    Content-Security-Policy
    script-src https://vouchernaut.com; connect-src https://vouchernaut.com; frame-src https://vouchernaut.com

Check your install

Is the widget on your site?

Open a page with the snippet, then paste the key from it here. We say whether the widget loaded on one of your allowed sites in the last 10 minutes.

It's in your snippet, and on the console's Developers page.