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

# Restoo Attribution Transfer

> Preserve campaign attribution and ad click identifiers while visitors browse your site, all the way through to the booking they make.

**Restoo Attribution Transfer is a small script for your website that stops attribution getting lost before the guest books.**

The problem it solves is a common one: an ad drops a visitor on your homepage with campaign parameters and a click identifier in the URL, they browse around, and by the time they reach your reservations page those parameters are gone from the address bar — so the booking is recorded with **no attribution at all**, and the ad platform never learns that its click ended in a booking.

Add the script to **every page of your website** and those parameters are captured wherever the visitor lands, then carried through to the page where they book. It works the same whether the widget is embedded in your site or your guests book on your Restoo page. **Nothing is stored without the visitor's permission.**

## What it carries

Two groups of parameters, kept apart because they feed two different attributions:

| Group        | Parameters                                                                                           | Who reads them                                                                                                              |
| ------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Campaign** | `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`                                | Restoo, in the booking and in every widget event: see [Campaign attribution](/widget/attribution)                           |
| **Ad click** | `gclid`, `gbraid`, `wbraid` (Google Ads), `fbclid` (Meta), `ttclid` (TikTok), `oppref` (ChatGPT Ads) | Each platform's own pixel, which needs its identifier in the address of the page where the booking happens to credit the ad |

Where each group travels depends on where the guest books. With the widget **embedded in your site**, the campaign reaches the widget on its own — Restoo.js hands it over — and the click IDs stay on your page, which is where your pixels run and read them. On **your Restoo page**, the script writes both groups into the link as the visitor follows it, so the widget reads the campaign and the pixels Restoo loads read their click ID from the address.

Each group is replaced whole and never touches the other: a new campaign without a click ID keeps the click ID stored earlier, and a new click ID without a campaign keeps the campaign. A link to your Restoo page that already declares its own campaign keeps it and still receives the click IDs; one that already carries a click ID, from any platform, receives no other.

## Installation

<Steps>
  <Step title="Add the script to every page of your website">
    Paste it just before your closing `</body>` tag.

    ```html theme={null}
    <script src="https://cdn.myrestoo.net/js/tracking/v1/restooAttributionTransfer.js"></script>
    ```

    <Note>
      **Why every page?** You can't know which page a campaign will land on, and if
      the script isn't running there, those parameters are never stored: they are
      lost the moment the visitor moves to the next page.
    </Note>
  </Step>

  <Step title="Declare the consent">
    Without consent the script stores nothing. There are two ways to declare it:

    <Tabs>
      <Tab title="With data-restoo-cmp">
        Recommended if your [consent platform](/widget/consent#what-a-consent-management-platform-is) is a supported one. You declare it with [`data-restoo-cmp`](#data-restoo-cmp) on the `<script>` itself.

        ```html theme={null}
        <script
          src="https://cdn.myrestoo.net/js/tracking/v1/restooAttributionTransfer.js"
          data-restoo-cmp="COOKIEBOT"
        ></script>
        ```
      </Tab>

      <Tab title="With setConsent()">
        Your cookie notice is your own, or your platform is not supported. You report the decision yourself with [`setConsent()`](#setconsent-signals), when the visitor accepts and when they withdraw consent.

        ```html theme={null}
        <script src="https://cdn.myrestoo.net/js/tracking/v1/restooAttributionTransfer.js"></script>
        <script>
          // from your cookie notice's callback, on accepting and on withdrawing consent
          RestooAttributionTransfer.setConsent({ ad_storage: "granted" });
        </script>
        ```
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Declaring consent

Consent is declared in one of two ways, and the script behaves the same either way:

* [`data-restoo-cmp`](#data-restoo-cmp), an attribute on the `<script>`: Restoo Attribution Transfer reads the decision from your [consent platform](/widget/consent#what-a-consent-management-platform-is).
* [`setConsent(signals)`](#setconsent-signals), a method: you report it yourself from your cookie notice.

Everything else, capturing the URL parameters and handing them over to the widget and to the link, happens automatically.

### `data-restoo-cmp`

An attribute on the `<script>`. Declares the [consent management platform](/widget/consent#what-a-consent-management-platform-is) installed on your website, which Restoo Attribution Transfer reads the visitor's decision from, including when they change it later. A withdrawal read from that platform **deletes anything already stored**.

```html theme={null}
<script
  src="https://cdn.myrestoo.net/js/tracking/v1/restooAttributionTransfer.js"
  data-restoo-cmp="COOKIEBOT"
></script>
```

**Values**

<ParamField body="data-restoo-cmp" type="&#x22;COOKIEBOT&#x22; | &#x22;GOOGLE_CONSENT_MODE&#x22;">
  The consent platform the decision is read from. Leave the attribute out and the
  consent only ever arrives through [`setConsent()`](#setconsent-signals). What each
  value covers, and where it reads from, is in
  [Consent](/widget/consent#declare-your-consent-platform).
</ParamField>

### `setConsent(signals)`

You report the visitor's decision yourself, instead of Restoo Attribution Transfer reading it from your platform. Call it from your cookie notice when the visitor accepts and when they withdraw consent.

```js theme={null}
RestooAttributionTransfer.setConsent({ ad_storage: "granted" });
```

Reporting `"denied"` **deletes anything already stored**, so a withdrawal needs no separate call.

```js theme={null}
RestooAttributionTransfer.setConsent({ ad_storage: "denied" });
```

**Parameters**

<ParamField body="signals" type="object" required>
  An object with the Google Consent Mode v2 `ad_storage` signal — storage for
  advertising purposes — whose value must be exactly `"granted"` or `"denied"`.
  It is the only signal this script uses: pass your platform's whole consent
  object and the rest are discarded.
</ParamField>

## What needs consent

**Without permission you don't lose all the attribution, only the hop between pages.** A visitor who arrives from the ad and books without wandering is attributed all the same, because the campaign is still in the address. One who passes through several pages before booking is not — and carrying that across is exactly what this script adds. The same goes for the ad click: the pixel reads it for free from the address it lands on, and remembering it for the next page needs the permission. [Campaign attribution](/widget/attribution#consent) covers what needs consent and what doesn't.

The asking is yours, not Restoo's: the script runs on **your own domain**, so the one putting the question is your [consent platform](/widget/consent#what-a-consent-management-platform-is) or your own cookie notice. Restoo only receives the answer.

And what it stores is always the **last campaign** and the **last click**, each group on its own, expiring after 30 days: [the full model](/widget/attribution#attribution-model) is in Campaign attribution.

## Next steps

<CardGroup cols={2}>
  <Card title="Campaign attribution" icon="bullseye" href="/widget/attribution">
    The full rule: last touch, default values, and the `acquisition` object.
  </Card>

  <Card title="Consent" icon="shield-check" href="/widget/consent">
    How you declare your consent platform, and what each signal unlocks.
  </Card>
</CardGroup>
