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

# How attribution works

> Learn how Manalens uses attribution to connect acquisition touchpoints to installs, wishlists, and purchases and measure channel performance.

## Overview

Player acquisition is one of the biggest problems for a game studio. A game needs **sustainable unit economics**: the lifetime revenue of a player (LTV) must be greater than the cost to acquire the player (CAC), by a healthy multiple.

Without attribution, you cannot tell which posts, creators, festivals and ads work. Attribution helps answer:

* Where did players come from?
* What did players do next: wishlist, install, play, buy?
* Which channels bring players who keep playing (retention) and who pay (revenue)?
* Which campaigns deserve more time or budget?

## Example

Attribution for a game is complex. Consider this journey of one player of a game called Star Forge:

1. The player watches a creator's YouTube video and clicks the link in the description, `starforge.com/?ref=LUCA` (**touchpoint**).
2. The player reads the press kit page and clicks the Steam button. Steam does not tell you that the click became a wishlist.
3. A week later, the player sees a Reddit devlog post and visits `starforge.com/?utm_source=reddit&utm_campaign=devlog` (**touchpoint**).
4. The player downloads the demo and opens it for the first time: `game_open` with `is_first_open: true` (**install**).
5. The player finishes the tutorial: `tutorial_complete`.
6. The player buys the soundtrack on the website with Stripe: `purchase` (**conversion**).

Two touchpoints led to the conversion: the YouTube creator and Reddit. An [attribution model](https://docs.manalens.dev/attribution/models.md) decides which one gets the credit:

* With **first touch**, the whole conversion goes to the creator code `LUCA` (channel Referrals).
* With **last touch**, the whole conversion goes to Reddit (channel Organic Social).
* With **linear**, each touchpoint gets half.

## How attribution works in Manalens

To follow the whole journey, Manalens connects two places: your website, where campaigns land, and your game, where players play and pay. Here is a high-level overview:

```mermaid theme={null}
sequenceDiagram
    participant Player
    participant Website as Website (Web SDK)
    participant Game as Game (game SDK)
    participant Manalens

    Player->>Website: visit from a link, a post or an ad
    Website->>Manalens: page view with referrer, UTM, ref and click IDs
    Manalens->>Manalens: classify the channel, keep a match key for 72 hours
    Player->>Website: click the Steam button (store_click)
    Player->>Game: install and open the game
    Game->>Manalens: first game_open
    Manalens->>Manalens: link the install to the website visitor
    Player->>Game: play and buy
    Game->>Manalens: tutorial_complete, purchase
    Manalens->>Manalens: join identities, find the touches, give credit by model
```

Each conversion goes through four steps:

```mermaid theme={null}
flowchart LR
    A["1. Touchpoint capture<br/>referrer, UTM, ref,<br/>ad click IDs"] --> B["2. Identity stitching<br/>user ID, cross-domain link,<br/>install match"]
    B --> C["3. Conversion<br/>a named event, such as<br/>purchase or game_open"]
    C --> D["4. Credit by model<br/>first touch, last touch,<br/>linear and more"]
```

Manalens has two parts:

* **Attribution:** event-based analytics about where, how, and at what time players reach your website: referrers, UTM parameters, referral codes, ad click IDs and channels.
* **Identity:** joining the events of one player into one [profile](https://docs.manalens.dev/features/profiles.md): website visits, game installs, sessions and purchases.

## 1. Touchpoint capture

The [Web SDK](https://docs.manalens.dev/sdks/web.md#referrals-and-campaign-capture) reads the landing URL and the referrer of each page view:

| Field | Source |
| - | - |
| UTM | `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, and `utm_id`, `utm_source_platform`, `utm_creative_format`, `utm_marketing_tactic` |
| Referral | `ref`, `referral` or `referral_code` in the URL, or a [typed referral code](https://docs.manalens.dev/features/referral-codes.md) |
| Ad click IDs | `gclid`, `gbraid`, `wbraid`, `fbclid`, `msclkid`, `ttclid`, `twclid`, `li_fat_id`, `rdt_cid`, `ScCid`, and `gad_source` |
| Referrer | The external origin only, or an Android app such as `android-app://com.google.android.youtube` |

Manalens adds two fields. `paid_source` is the ad network. Its values are `google`, `meta`, `microsoft`, `tiktok`, and `twitter`. Other values are `linkedin`, `reddit`, `snapchat`, and `paid_utm` for a paid `utm_medium`. `click_id` is the first click ID. Then it classifies the [channel](#acquisition-channels). Values over 255 characters, or with unsafe characters, are dropped.

Some referrers are not a source:

* **Your own site:** your project domain, its subdomains, other hosts with the same root domain, and your allowed origins.
* **Sign-in and checkout pages:** for example `accounts.google.com`, `steamcommunity.com/openid`, `checkout.stripe.com` or `paypal.com`. A player who comes back from a sign-in or a payment did not come from Google or PayPal.

A game on itch.io runs in a frame on `*.itch.zone`. When the page has no referrer, Manalens sets the referrer `https://itch.io`, so the visit counts as Referrers, not Direct.

A game build has no landing page, so its events have no campaign fields. Server events have none either. Reports show them as Direct. [Install attribution](#install-matching) gives an install the source of the website visit before it.

## Campaign continuity

In a single-page app, the SDK keeps the landing campaign in memory and adds it to later `track` and `identify` calls. A new tagged landing replaces the whole campaign, so two campaigns are never mixed. The campaign is not written to browser storage.

## Acquisition channels

Manalens gives each browser event one channel (`channel_type`) as it stores the event. The first matching rule wins:

| # | Channel | Rule |
| - | - | - |
| 1 | **Paid Search** | A paid signal and a search engine (Google, Bing, DuckDuckGo and others) |
| 2 | **Paid Video** | A paid signal and a video site (YouTube, Twitch, Vimeo and others) |
| 3 | **Paid Social** | A paid signal and a social site (Reddit, X, TikTok, Discord, Facebook and others) |
| 4 | **Email** | `utm_medium` `email`, `e-mail`, `e_mail` or `newsletter`, or a mail or newsletter site |
| 5 | **Display** | An ad network domain, such as `doubleclick.net` |
| 6 | **Referrals** | A referral code (`?ref=` or a typed code), or `utm_medium` `referral` or `affiliate` |
| 7 | **Display** | `utm_medium` `display`, `banner`, `expandable` or `interstitial` |
| 8 | **Paid Search** or **Paid Social** | A click ID alone. Google and Microsoft are Paid Search. Meta, TikTok, X, LinkedIn, Reddit and Snapchat are Paid Social. An in-app browser often drops the referrer. |
| 9 | **Paid Other** | Any other paid signal |
| 10 | **AI** | An AI assistant, such as ChatGPT, Claude, Perplexity or Gemini |
| 11 | **Organic Search** | A search engine, or `utm_medium` `organic` |
| 12 | **Organic Social** | A social site, or a social `utm_medium` such as `social` |
| 13 | **Organic Video** | A video site |
| 14 | **Referrers** | Any other referrer or `utm_source` |
| 15 | **Direct** | No referrer and no campaign |

There are 13 channels: Display, Paid Search and Paid Social each have two rules. The site lists match the referrer domain (without `www.` and `m.`) and the lower-case `utm_source`.

A **paid signal** is an ad click ID, `gad_source`, or a paid `utm_medium`. A paid `utm_medium` is `cpc`, `cpm`, `cpv`, `cpa`, `ppc`, or `paidsearch`. It can also be `paidsocial`, `sem`, `retargeting`, or any value that starts with `paid`.

## Sessions and touches

A session groups the events of one visit. It ends after 30 minutes without events. A session has the source of its first page view. See [sessions](https://docs.manalens.dev/data/metrics.md#sessions).

A **touch** is a page view that starts a session, or a page view with a new source, medium, campaign, referrer, referral or click ID. Repeated page views with the same source in one session are one touch, so they do not get more credit.

## 2. Identity stitching

A player can visit your website on a phone, then on a laptop, then open your game. When a link is certain, Manalens joins these into one player:

* **The same user ID.** Call `identify()` with the same user ID on the website, in the game and on your server. See [identify users](https://docs.manalens.dev/guides/identify-users.md).
* **A cross-domain link.** The game opens your website with a cross-domain link (`get_cross_domain_url()` in Godot, `GetCrossDomainUrl()` in Unity, **Get Cross Domain URL** in Unreal). The website then joins this player without sign-in.
* **A browser game on your domain.** It shares the visitor ID with your website.

An anonymous visitor joins a user only through a browser that links to exactly one user. When several accounts share a browser, the anonymous events stay anonymous. See [core concepts](https://docs.manalens.dev/data/concepts.md#people-and-identity-links).

## Install matching

A native game build cannot read your website's cookie. Without a certain link, Manalens matches a first open of the game (`game_open` with `is_first_open: true`) to a website visitor on the same network:

1. A website visit keeps a keyed hash of the visitor's IP address for **72 hours**. The IP address is never stored.
2. The first open of the game makes the same key.
3. One to three visitors with the key give a match. More give none (an office, a school, a VPN).
4. The install gets the source of that visitor's page views, with the first touch, the last touch, or the last non-Direct touch.

A network match is likely, not certain, so it never joins two profiles. See [install attribution](https://docs.manalens.dev/attribution/installs.md).

## Attribution waterfall

Manalens uses the strongest link it has. The certain links (1 to 4) apply together: they join the IDs of one player into one profile. If an install has no certain link to a website visit in the lookback, it falls back to the Google Play install referrer (5). Then it falls back to the network match (6).

| # | Method | Link | Flows | How it works |
| - | - | - | - | - |
| 1 | **Same user ID** | Certain | Website to game, website to server, device to device | `identify()` with the same user ID on the website, in the game and on your server. See [identify users](https://docs.manalens.dev/guides/identify-users.md). |
| 2 | **Cross-domain link** | Certain | Game to website (PC and mobile builds, and console builds where the platform lets a game open a web page) | The game opens your website with a cross-domain link, so the website visit joins the game install without a sign-in. |
| 3 | **Browser game on your domain** | Certain | Website to browser game | The game shares the visitor ID of your website. |
| 4 | **Verified Steam link** | Certain | Game install to game install, such as a desktop and a Steam Deck | Game installs that verified the same Steam account are [one player](https://docs.manalens.dev/integrations/steam.md#one-player-per-account), so a website touch linked to one install counts for purchases on the other. |
| 5 | **Google Play install referrer** | Certain | Google Play link to Android install | Google Play passes the campaign of the store link to the game. Installs only. See [Android](https://docs.manalens.dev/attribution/installs.md#android-the-play-install-referrer). |
| 6 | **Network match** | Likely | Website to a native game install | A keyed hash of the IP address, kept for 72 hours. One to three visitors on the network give a match. Installs only. See [install matching](#install-matching). |

Methods 5 and 6 only credit an install: they never join two profiles, so a purchase in the game is credited to the website only through methods 1 to 4.

A [referral code](https://docs.manalens.dev/features/referral-codes.md) is not a link between two devices: it is a touch of its own. A code typed in the game, on your website or at checkout gets credit wherever it is typed.

Manalens does not use fingerprinting, advertising IDs (IDFA or GAID) or data from mobile measurement partners.

## 3. Conversion

A conversion is an exact, named event, such as `purchase`, `wishlist_clicked`, `tutorial_complete` or `game_open`. There is no guess from event names. Store payments from Stripe, Paddle and itch.io count as `purchase` events, and a verified [Steam link](https://docs.manalens.dev/integrations/steam.md#steam-purchases) adds Steam purchases. A sale is counted once: see [revenue](https://docs.manalens.dev/features/revenue.md#one-sale-is-counted-once).

Only the touches at or before the conversion, inside the lookback window, count. A conversion with no touch is **unattributed**.

## 4. Credit by model

Manalens has six rule-based [attribution models](https://docs.manalens.dev/attribution/models.md):

| Model | Credit |
| - | - |
| First touch | 100% to the first touch |
| Last touch | 100% to the last touch |
| Last non-Direct (default) | 100% to the last touch that is not Direct |
| Linear | Equal credit to every touch |
| Position-based | 40% to the first touch, 40% to the last, 20% split across the middle |
| Time decay | More credit to recent touches, with a 7-day half-life by default |

See a [worked example](https://docs.manalens.dev/attribution/models.md#worked-example) with numbers for each model.

Which touches count, and how far back, depends on the report:

| Report | Credit | Lookback |
| - | - | - |
| **Attribution, Conversions** | The model you choose, last non-Direct by default, over all the touches of each conversion | 90 days by default (30 to 365). The API default is 30. |
| **Attribution, Installs** | The model you choose, last non-Direct by default, over the page views of the linked website visitor | 30 days by default (7 to 365) |
| **Player profiles and the Players list** | The first and last value of each field over the player's whole history | All history |
| **Funnels and retention** | A breakdown uses each player's first value in the date range. A funnel can use the last value instead. **Install channel** on a retention chart uses the touch credited to the player's first install, with last non-Direct. | The date range |
| **Overview traffic** | A session has the channel of its first page view | The session |
| **Overview revenue** | A website purchase has the source of its own visit. A game, server or store purchase with no source of its own has the source of the player's first page view before it, else Direct. | 90 days, for the first page view |

On Players and profiles, each field is resolved on its own. The fields are channel, referrer, referral, ad network, each UTM parameter, and click ID. So a player's first `utm_source` and first referrer can come from different visits.

> [!NOTE]
>
> Overview revenue by source and the Attribution page use different rules, so their numbers by source do not match. Use the Attribution page to compare models, and Overview for a quick split of all revenue.

## Steam store visits

Links to your Steam page do not visit your website, so the Web SDK does not see them. Steam's own **UTM Analytics** counts store visits, wishlists and purchases from links to your store page with `utm_` parameters. Manalens imports it every day: see [Steam](https://docs.manalens.dev/integrations/steam.md#automatic-utm-import).

Steam credits a wishlist only to a visit by a player signed in to Steam, within 72 hours of the click. Manalens estimates how many of all your wishlists came from your campaigns. It combines Steam's daily wishlist adds, the UTM Analytics rates, and the store clicks on your website. See [wishlist attribution](https://docs.manalens.dev/attribution/wishlists.md).

## Referral codes

A creator can share a link with `?ref=LUCA`. A creator can also ask viewers to type the code `LUCA` in the game, in a form on your website, or at checkout. Both are the same referral: codes are upper case, so `?ref=luca` and a typed `LUCA` add up. A referral is the **Referrals** channel. See [referral codes](https://docs.manalens.dev/features/referral-codes.md).

## Ad click IDs

Paid traffic is attributed with the click ID that each ad network adds to your landing URL. Manalens keeps every click ID and names the network in `paid_source` (Google, Meta, Microsoft, TikTok, X, LinkedIn, Reddit or Snapchat). It uses the click ID for the channel with no referrer too. A missing referrer is common in in-app browsers. `gad_source` marks Google as the source but is not a click ID. See [what we collect](https://docs.manalens.dev/data/what-we-collect.md#campaign-and-ad-parameters).

## Limits

Attribution uses observed visits and clicks. It does not track ad impressions or view-through, import ad spend, or compute ROAS or cost per install. It has no data-driven model. Profiles join only on a certain link. The [network match](#install-matching) of installs is likely, not certain: it credits an install but never joins two profiles. Attribution cannot see missing referrers, untagged links or cleared cookies. Visits on another device join only after `identify()` with the same user ID, or a cross-domain link from your game.

## Glossary

| Term | Definition |
| - | - |
| Player journey | The touchpoints and the conversion of one player. A conversion can have no touchpoint (no referrer, UTM or referral). It is then a Direct or unattributed conversion. |
| Conversion | The event you want to attribute: usually an install (`game_open` with `is_first_open`), a wishlist click, or a revenue event such as `purchase`. |
| Touchpoint | A visit that brought the player before the conversion, such as a creator link, a Reddit post or an ad click. If a player does A, B, C, then D (the conversion), then A, B and C are touchpoints. |
| Channel | The category of a touchpoint, such as Paid Social, Organic Video, Referrals or Direct. See [acquisition channels](#acquisition-channels). |
| Lookback window | The days before a conversion in which touches count. |
| Assist | A touch in the lookback that did not get the last non-Direct credit. See [assists](https://docs.manalens.dev/attribution/models.md#assists). |
| Install match | A likely link between a first open of the game and a website visitor on the same network, within 72 hours. |

## FAQ

> [accordion] Does Manalens capture attribution parameters automatically?
>
> Yes. When a visitor lands on your website, the Web SDK captures UTM parameters, the browser referrer, referral codes and ad click IDs. Manalens associates them with the session and the player. A game install gets the source of the website visit before it through [install attribution](https://docs.manalens.dev/attribution/installs.md).

> [accordion] What happens if a player visits from several sources before converting?
>
> Manalens records every touch. The Audience page and player profiles show the first-touch and last-touch values. The Attribution page splits the credit with the [model](https://docs.manalens.dev/attribution/models.md) you choose, and **Compare models** shows two models side by side.

> [accordion] Can I use both UTM parameters and ref codes on the same link?
>
> Yes. Combine them for full attribution: `?ref=LUCA&utm_source=youtube&utm_medium=video`. Both are captured. The channel is Referrals: in the [channel rules](#acquisition-channels), a referral code comes before Organic Video. With a paid signal and a search, video or social source (for example `utm_medium=paid` and `utm_source=youtube`), a paid channel comes first.

> [accordion] Does attribution work when a player installs on another device?
>
> Only with a certain link: the same user ID from `identify()` on both devices, or a cross-domain link. The network match of install attribution needs the same network within 72 hours. So a visit on a phone network followed by an install on home Wi-Fi is not matched.


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