# Signups across domains

> Keep one session when a visitor moves from your marketing site to your app on another domain, so a signup or purchase there is credited to the source that brought them.

A visit on `example.com` and a signup on `app.example.com` are two sessions by default, because a browser keeps session storage per origin. The signup then shows up with no source: the referrer, campaign and landing page stayed on the first domain. This page is how to carry the session across, so the event on the second domain is read against the visit that started on the first.

Nothing on this page is needed when the site and the app share one origin. It is for a marketing site and an app, a shop and a checkout on another domain, or a site split across country domains.

## Before you start

Both domains need the Clerion snippet with the same site id. On the app, auto-tracking can stay on or off: with `data-auto-track="false"` the app sends only the events you name, so its pages never count toward the site's traffic. See [Script tag](https://getclerion.com/docs/script-tag).

## Subdomains: nothing to do

A link from `example.com` to `app.example.com` carries the session over on its own. When a visitor clicks a link to a sibling subdomain, the snippet adds `clerion_sid` to the link, and the snippet on the other side continues that session instead of starting one. There is nothing to add to the links.

Any custom event sent on the app then belongs to the session that began on the site:

```js
window.clerion.trackEvent("signup_completed", { plan: "starter" });
```

The hand-off applies to links the visitor clicks. A redirect, a form `action` or a link built in JavaScript that navigates with `location.href` does not go through a click, so use `linkTo` for those.

## A different domain: linkTo

When the two domains do not share a root, for example `example.com` and `example-app.io`, build the link with `linkTo`:

```js
const href = window.clerion.linkTo("https://example-app.io/signup");
```

It returns the address with the current session attached. Use it wherever you build the link: a React `href`, a redirect, or a form submission that opens the other domain. The snippet on the other domain reads the parameter when it loads and continues the session.

A link built before the tracker exists has no session to attach; guard it, or set the `href` once `window.clerion` is there.

## What you see

On Custom events, the event sent from the app counts with the source of the visit that led to it. [Conversion insights](https://getclerion.com/docs/custom-events) and [Revenue by source](https://getclerion.com/docs/revenue-by-source) read the same session, so a purchase on the app is credited to the campaign or referrer that brought the visitor to the site. Over MCP, the conversion insights tool answers the same way.

## Limits

| Limit | What it means |
|---|---|
| Same tab | The session lives in the tab. A link opened in a new tab carries the session in its address; a visitor who types the app's address into a new tab starts a fresh session. |
| 30 minutes | A session ends after 30 minutes without activity, on either domain. A signup after that is a new session with no source. |
| Click only | The automatic hand-off to a subdomain happens when a link is clicked. Redirects and script navigation need `linkTo`. |
| Two-label root | "Same site" is judged on the last two labels of the hostname, so `shop.example.co.uk` and `example.co.uk` do not match on their own. Use `linkTo`. |

The parameter is a session id only. It carries no personal data and nothing about the visitor's previous pages; those stay in the events already recorded on the first domain.

---

Source: https://getclerion.com/docs/cross-domain-sessions (Clerion docs, Tracking). The whole manual as one file: https://getclerion.com/docs/everything.md
