> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pagamerican.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect your pages

> Add the script and the button attributes to your upsell and downsell pages.

Your upsell and downsell pages stay yours, served from your own domain. The platform drives the funnel from inside them with one script tag and two attributes on your buttons.

The whole integration is those two things. Everything else on this page is the detail that decides whether a click charges the card or throws the sale away.

> [!NOTE]
>
> Selling through a Shopify store? Your pages use an offer tag instead of button attributes. See [Connect your store pages](https://docs.pagamerican.app/sales-funnel/connect-your-store-pages.md).

## 1. Add the script to your upsell and downsell pages

Paste this as the last element before the closing `</body>` tag, on **every upsell and downsell page** of the funnel:

```html theme={null}
<script src="https://scripts.pagamerican.app/s.js"></script>
```

Nothing works without it. The script charges the offer when the buyer accepts and moves the buyer to the next step.

> [!WARNING]
>
> **Don't add the script to the thank-you page.** The buyer reaches the thank-you page at the end of the funnel, where there is nothing left to charge. With the script on it, the page shows a "You are not allowed to continue" notice to every buyer who finished the funnel. Keep the thank-you page free of the script.

## 2. Mark the buttons

The script does not care what your buttons look like. It only looks for these attributes:

| Attribute | What it does |
| - | - |
| `data-pag-yes` | Marks the **buy** button. Only its presence counts, the value is ignored. |
| `data-pag-offer="CODE"` | Goes on the **same element** as `data-pag-yes`. It is the offer **code**, not the SKU. |
| `data-pag-no` | Marks the **decline** button, which leads to the next step without a charge. Presence only, and it carries no offer code. |
| `data-pag-processing-message="TEXT"` | Optional, on the buy button. Replaces the text shown while the purchase is processed. |

Write the attributes bare: `data-pag-yes`, not `data-pag-yes="true"`. Each offer inside a step shows the snippet `data-pag-yes data-pag-offer="CODE"` with a **Copy** button next to it, with your offer code already filled in.

> [!WARNING]
>
> **If you use `<a>`, leave it without `href`.** What loses the sale is the `href`, not the tag. The script starts handling clicks only after the page has **fully** loaded: every image, font and video. On a heavy VSL that takes seconds, and a buyer who clicks an `<a href>` in that window leaves the page. With no `href`, the same click simply does nothing and the buyer clicks again.
>
> Any tag works, as long as it carries no `href`: `<button>`, `<div>`, or `<a data-pag-yes data-pag-offer="CODE">`. The `href` is ignored either way, because the platform decides where the buyer goes next.

> [!TIP]
>
> The hand cursor is on you. A `<button>`, and an `<a>` without `href`, keep the arrow cursor and look unclickable. Add `style="cursor: pointer"` to the tag, or `cursor: pointer` in your CSS. That detail is exactly what tempts people into adding an `href`, which gets the hand cursor for free from the browser.

## The pair, ready to copy

```html theme={null}
<button type="button"
        data-pag-yes
        data-pag-offer="YOUR_OFFER_CODE"
        style="cursor: pointer">
  Yes, I want it
</button>

<button type="button"
        data-pag-no
        style="cursor: pointer">
  No, thanks
</button>
```

The same pair with anchors, for a page whose styling is built around links:

```html theme={null}
<a data-pag-yes data-pag-offer="YOUR_OFFER_CODE" style="cursor: pointer">Yes, I want it</a>

<a data-pag-no style="cursor: pointer">No, thanks</a>
```

Swap `YOUR_OFFER_CODE` for the code shown on your step. To see what the buyer gets on each click, read [What the buyer sees](https://docs.pagamerican.app/sales-funnel/how-it-works.md#what-the-buyer-sees).

## The domain has to match exactly

Each page must be served from the same domain you entered in the step's **Page URL**. `www.yourstore.com` and `yourstore.com` are different domains here, and a page whose domain does not match cannot charge the buyer.

## Test it end to end

Opening a funnel page directly in the browser shows a notice instead of your content, and that is expected: the page only runs when the buyer arrives from the checkout. To test for real, make a test purchase of the offer the funnel is attached to and follow the flow. A test purchase is a real purchase: it charges the card you use, so refund it from the order afterwards.

Use a **different email for each test purchase**. The checkout accepts one purchase of the same product per email per day (UTC): a second one shows "Purchase already completed" and charges nothing, so it never reaches your funnel.

<video autoPlay muted loop playsInline src="https://mintcdn.com/pagamerican/zh0cPV2kZD8Kg0u-/videos/sales-funnel/test-purchase.mp4?fit=max&auto=format&n=zh0cPV2kZD8Kg0u-&q=85&s=e0f09717d825b34b8201f3a3c671ecf5" />

A test purchase that lands on the upsell page

## Next step

> [card] [How it works](https://docs.pagamerican.app/sales-funnel/how-it-works.md)
>
> What the buyer sees on each click, how funnel purchases are charged and how they reach the order.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.