# Building a funnel on your own site

A funnel in Acrune is a plan for pages you own. You draw the steps a visitor
should take and how each leads to the next, and whoever holds your site's code
builds the site to match. Acrune then checks the site against the plan and
counts the visitors who walk it.

Nothing in Acrune serves a page or moves a visitor. A connection on the canvas
is a link you intend to exist; it becomes real when it is on your page.

## What a step is

A step is counted in one of two ways.

**A page.** The step holds a page address: a path on your site such as
`/quiz`, or a full address. End it with `*` to include every page beneath it.
A visitor is counted when that page opens.

**An event.** Some steps are not a page. A quiz finished on one screen of an
app, a form sent from a modal, an order placed in a checkout your site does
not serve: nothing loads, so there is no address to match. Give the step an
event name and say so from your own code.

## The tag

Every funnel has one tag. Copy it from the funnel's Setup tab and put it once
in the shared head of your site.

```html
<script async src="https://acrune.com/dashboard/api/funnels/script?key=pf_..."></script>
```

It reports the page a visitor is on and the creator link they arrived by. It
follows navigation in a single-page app without help, reads no form or field,
and stays silent for a visitor who has sent Do Not Track or Global Privacy
Control. It does not show a consent banner: load it only when your own consent
controls allow.

## Steps that are not pages

Where the visitor reaches the step, call it by the name on the step.

```js
window.acrune.step("quiz_done")
```

Names are lowercase letters, digits, `_`, `.` and `-`, up to 64 characters.
The name is the whole message: send no form values and no personal details.
A visitor counts once per step per day, so calling it twice does no harm.

If the call can run before the tag has loaded, queue it. The tag sends what is
waiting when it arrives, after the first page view.

```js
window.acruneQueue = window.acruneQueue || []
window.acruneQueue.push(["step", "quiz_done"])
```

A name that no step asks for is ignored, as is any name sent while the funnel
is a draft or paused.

### What a step was worth

A step that is an order can carry the order's value. Send the amount and its
currency with the call, both or neither:

```js
window.acrune.step("purchased", { value: 49.5, currency: "USD" })
```

The step then shows what it was worth over the same days as its visitors. A
visitor counts once per step per day, so a second order the same day is not
added: the figure can be low, never high. Nothing else about the order is
sent or kept.

## Shopify

Use the custom pixel from Setup, not the tag, and never both on one store. The
pixel counts page visits and also sends what the store does by itself, so the
checkout can be a step without any code:

| Step counted by | When |
| --- | --- |
| `shopify.product_viewed` | A product page is viewed |
| `shopify.product_added_to_cart` | Something is added to the cart |
| `shopify.cart_viewed` | The cart is opened |
| `shopify.checkout_started` | Checkout begins |
| `shopify.payment_info_submitted` | Payment details are entered |
| `shopify.checkout_completed` | An order is placed |

On the step, press This step isn't a page, then It's a Shopify store, and pick
one. An order placed carries its total and currency, and nothing else from the
order: no email, no address, no line items. It waits for the visitor's
Analytics and Marketing permission. A pixel pasted before these events existed
sends page visits only, so paste a freshly generated one.

### Connecting a store without pasting

Where Acrune's Shopify app is available, Setup shows **Connect** on the
Shopify row instead of the pixel code. Enter the store's `myshopify.com`
address, approve the app in Shopify, and the pixel is switched on for this
funnel. The app asks only for permission to run its pixel. It keeps no access
to the store afterwards: connecting another funnel asks Shopify again.
Removing the app in Shopify disconnects the store.

### What a connected store adds

Once the store is connected, the Shopify row in Setup lists its pages and
products. **Add as step** puts one on the canvas at its own address.
**Use its stages** fills every step that has no address with the store's
path to an order: product viewed, added to cart, checkout started, order
placed.

A store connected before this is asked to **Approve reading it** once. The
app reads products, pages and the theme, and can write pages. It reads no
customers and no orders.

### Building a page in the store

A step with a store connected, and no Framer project, offers **Build it in
Shopify**. Say what the page is for and press Create. The page is designed
and saved in the store as an unpublished page under `/pages/`. Nothing is
published: open it in Shopify to edit and publish it.

The store's theme supplies the header, footer, fonts and colours, so the
picture in Acrune shows the page's content alone. Building again replaces a
draft Acrune made. A published page, or one Acrune did not make, is never
touched.

### A quiz and a sign-up in your theme

The app adds two blocks to the theme editor, under Apps: **Acrune quiz** and
**Acrune sign-up**. Add one to any page template and fill in its settings.
Each has an **Acrune step name**. Give the step in your funnel the same
name: on the step, press This step isn't a page, and type it.

Finishing the quiz, or signing up, counts on that step. No answer and no
email address is sent to Acrune: the sign-up is the store's own customer
form.

### What cannot be done in a store

- The checkout's own steps can only be changed on Shopify Plus. They are
still counted on every plan.
- Acrune does not change an existing page's design or the theme's files.
Shopify grants that only to full page builders, by application.

## Handing the build to a coding agent

On the canvas, **Have your coding agent build it on your site** opens a build
task. Paste it into the agent working in your site's repository. It asks for,
in order:

1. What already exists: which planned pages are served, and which connections
already have a link.
2. The pages that are missing, at their planned addresses, in your site's own
layout and components.
3. Each connection as a real link, and each event step as a call.
4. The tag, once.
5. Proof: every connection walked in a browser, every step seen to send.

It tells the agent not to invent prices, claims or legal text, to mark any
placeholder copy, and not to publish without your go-ahead.

An agent connected to Acrune's MCP server can read the same plan with
`list_funnels` and correct a step's address with `save_funnel` if a page had
to live somewhere else.

The same agent can say where each step stands with `report_funnel_build`:
building, built, or blocked with one line saying what it needs from you. The
step then reads **being built**, **not published yet** or **Blocked** and the
line. Built means in the code. Whether the page is live is still Acrune's own
check, below.

## Reading the canvas while you build

Acrune looks at your site as soon as a saved step has an address, draft or
live.

- A step whose page does not load reads **not built yet**.
- A connection whose link is not on its page is drawn dotted.
- The overview counts the pages and links still to build, and asks **Is it
built** until the funnel is live, then **Is it measuring**.

These are read from outside, as a visitor's browser would fetch the page. A
link added by script after the page loads, or a page behind a sign-in, cannot
be seen this way and will read as missing when it is there.
