# Web quickstart: your first attributed sign-up

URL: https://traqio.app/docs/quickstart/web
Last updated: 2026-10-16

Tie a website's sign-ups to the ads that brought them: two keys, @traqio/web on the site, a server SDK on the backend, a tracking link to your site.

This guide ties a website's sign-ups to the ads that brought them. It takes four pieces: two keys, the browser SDK on the site, a server SDK on the backend, and a tracking link that lands on the site. At the end, a click on your link followed by a sign-up comes back attributed to the link's campaign — [by the id of that click](https://traqio.app/docs/concepts/web-attribution), not by a guess. For an app, the [app quickstart](https://traqio.app/docs/quickstart) is the one to follow.

> **Early access** @traqio/web and @traqio/node install from npm. The PHP and Python packages are not on Packagist and PyPI yet: write to hello@traqio.app to receive them; each SDK page says how to add them until the registry command works.

## Steps

### Create the two keys

In the console, open your product, then **Integrations → SDK**. Create:

- a **web key** (`tq_web_…`), listing every origin that runs the site — `https://www.example.com`, `https://app.example.com`. It is public: it goes in your pages, and works only from those origins;
- a **server key** (`tq_sk_…`). It is a secret, shown once: put it in your backend's environment as `TRAQIO_SECRET_KEY`.

### Add @traqio/web to the site

```bash
npm install @traqio/web
```

```ts
import { Traqio } from "@traqio/web";

Traqio.init({ sdkKey: "YOUR_WEB_KEY" }); // tq_web_… — a WEB key, not the app key
```

Once, as early as possible, on every page — the [web SDK page](https://traqio.app/docs/sdks/web) shows it for React, Vue, Angular and a plain `<script>` tag. When a visitor arrives from your link, it keeps the trackID in a first-party cookie on your domain.

### Report the sign-up from the backend

Node.js:
```bash
npm install @traqio/node
```

PHP / Laravel:
```bash
composer require traqio/traqio-php
```

Python:
```bash
pip install traqio
```

Node.js:
```ts
import { Traqio, trackIdFromRequest } from "@traqio/node";

const traqio = new Traqio({ secretKey: process.env.TRAQIO_SECRET_KEY! });

// where the account is created
const result = await traqio.signup({ userId: user.id, trackId: trackIdFromRequest(req) });
console.log(result.trackId, result.attribution); // "matched" { network: "meta", campaignId: "…", … }
```

PHP / Laravel:
```php
use Traqio\Laravel\Facades\Traqio;
use Traqio\TrackId;

// where the account is created — TRAQIO_SECRET_KEY is read from .env
$result = Traqio::signup((string) $user->id, TrackId::fromRequest($request));
logger()->info('traqio', ['trackId' => $result->trackId, 'campaign' => $result->attribution->campaignId]);
```

Python:
```python
import os
from traqio import Traqio, track_id_from_request

traqio = Traqio(os.environ["TRAQIO_SECRET_KEY"])

# where the account is created
result = traqio.signup(str(user.pk), track_id_from_request(request))
print(result.track_id, result.attribution)  # matched Attribution(network='meta', campaign_id='…', …)
```

Where the account is created, once. The sign-up request carries the cookie, so the trackID is read off it. Each SDK page — [Node.js](https://traqio.app/docs/sdks/node), [PHP / Laravel](https://traqio.app/docs/sdks/php), [Python](https://traqio.app/docs/sdks/python) — covers its frameworks, errors and purchases.

### Create a tracking link to your site

In **Links**, create a link: the ad network, the campaign id the network gives you — it is what joins clicks to spend — and, as **Website destination**, the page the ad should open. Put the link's click URL in the ad. A click lands on that page, on every device, with the trackID added:

```
https://www.example.com/pricing?traq_click=3f7c…&traq_source=meta&traq_campaign=summer
```

### Click, sign up, read the answer

Open the link's click URL in a browser, then sign up on the site with a new account. Your backend's `signup` call answers `matched`, and its attribution names the link's network and campaign.

> **Where to read it** The response of the server call gives the attribution at once. In the console, the ROAS report counts the sign-up as a web conversion of the link's campaign, beside its installs.

## Next

- Report purchases and subscriptions with `track`, with their value, currency and payment id — they follow the user to the campaign that acquired them.
- Read [web attribution](https://traqio.app/docs/concepts/web-attribution) for the rules: one click per identity, the attribution window, the last click before the sign-up.

## Frequently asked questions

**Why does my test sign-up come back without a trackID?**
The visit did not start from the tracking link, the page did not run @traqio/web, or your backend is on another domain than the site, so the traq_click cookie does not reach it. In the last case, send Traqio.getTrackId() from the browser with the sign-up form.

**Why does a second test sign-up answer claimed?**
A click credits one identity: once a click is bound to a user, another user cannot claim it. Click the link again for every test user — each click is a new trackID.
