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

# How to Set Up Marketing Attribution

> Track the complete user journey from first touch to onchain conversion with multi-touch attribution for crypto marketing campaigns.

Understand which marketing channels actually drive onchain conversions, not just clicks. This guide shows you how to set up attribution tracking, compare models, and optimize your marketing spend.

## What you'll learn

* Set up UTM tracking for all marketing channels
* Understand first-touch vs. last-touch attribution
* Measure true ROI by channel (to the transaction level)
* Optimize budget allocation based on conversion data

## Part 1: The Attribution Challenge in Crypto

### Why traditional attribution fails

Traditional analytics measure clicks and visits. For crypto apps, this misses what matters:

| What traditional tools measure | What actually matters            |
| ------------------------------ | -------------------------------- |
| Page views                     | Wallet connects                  |
| Time on site                   | Transactions completed           |
| Form submissions               | Volume/revenue generated         |
| Bounce rate                    | User quality (net worth, labels) |

### The crypto user journey

A typical onchain user touches multiple channels:

1. **Discovery**: Sees your tweet, ad, or mention
2. **Research**: Reads about you on Discord, docs, or DeFiLlama
3. **First visit**: Lands on your site (often without converting)
4. **Return visit**: Comes back from a different source
5. **Conversion**: Connects wallet and transacts

Each touchpoint matters. The question is: which one gets credit?

## Part 2: How to Set Up UTM Tracking

### UTM parameter basics

UTM parameters let you track where users come from:

```
https://yourapp.xyz/?utm_source=twitter&utm_medium=social&utm_campaign=launch_2024
```

| Parameter      | Purpose              | Examples                                       |
| -------------- | -------------------- | ---------------------------------------------- |
| `utm_source`   | The platform         | twitter, discord, newsletter, defillama        |
| `utm_medium`   | The channel type     | social, email, paid, referral                  |
| `utm_campaign` | The campaign name    | launch\_2024, airdrop\_promo, partnership\_xyz |
| `utm_content`  | The creative variant | banner\_a, thread\_1, video\_ad                |
| `utm_term`     | Keywords (for paid)  | defi, swap, yield                              |

### Where to add UTMs

Add UTM parameters to every link you control:

**Social media:**

```
https://yourapp.xyz/?utm_source=twitter&utm_medium=social&utm_campaign=daily_content
```

**Email campaigns:**

```
https://yourapp.xyz/?utm_source=newsletter&utm_medium=email&utm_campaign=weekly_update
```

**Partner/referral links:**

```
https://yourapp.xyz/?utm_source=partner_name&utm_medium=referral&utm_campaign=collab_jan
```

**Paid ads:**

```
https://yourapp.xyz/?utm_source=twitter_ads&utm_medium=paid&utm_campaign=retargeting&utm_content=banner_v2
```

### UTM naming conventions

Use consistent naming to make analysis easier:

| Bad                                  | Good              |
| ------------------------------------ | ----------------- |
| `twitter`, `Twitter`, `tw`           | Always `twitter`  |
| `paid ad`, `paid_ad`, `paidAd`       | Always `paid`     |
| `Launch`, `launch2024`, `jan-launch` | `launch_2024_jan` |

**Recommended format:**

* Lowercase only
* Underscores for spaces
* Include date/month for campaigns: `campaign_name_mmyy`

## Part 3: How to Set Up Referral Tracking

Referral programs are a powerful growth channel for crypto apps. Formo automatically captures referral codes alongside UTM parameters.

### Referral code basics

Add a `ref` parameter to your referral links:

```
https://yourapp.xyz/?ref=alice
```

When a user lands with a `ref` parameter, Formo captures it and associates it with the user's session. You can then attribute wallet connects and transactions back to the referrer.

### Where to add referral codes

**User-generated referral links:**

```
https://yourapp.xyz/?ref=0x1234...abcd
```

**Partner referral links:**

```
https://yourapp.xyz/?ref=partner_name
```

**Influencer referral links (combine with UTMs for full attribution):**

```
https://yourapp.xyz/?ref=influencer_handle&utm_source=twitter&utm_medium=social&utm_campaign=influencer_jan
```

### Referral naming conventions

| Bad                                     | Good                                 |
| --------------------------------------- | ------------------------------------ |
| Mixed case (`Alice`, `alice`, `ALICE`)  | Always lowercase (`alice`)           |
| Spaces or special characters (`my ref`) | Underscores only (`my_ref`)          |
| Generic names (`partner1`)              | Descriptive names (`uniswap_collab`) |

### Analyze referral performance

Use **Ask Formo** or the **Explorer** to query referral data:

> "Show me wallet connects and transactions grouped by ref parameter for the last 30 days"

```sql theme={null}
SELECT
  JSONExtractString(properties, 'ref') AS referrer,
  countDistinct(address) AS wallets,
  count(*) AS transactions
FROM events
WHERE JSONExtractString(properties, 'ref') != ''
  AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY referrer
ORDER BY wallets DESC
```

## Part 4: Understand Attribution Models

Formo supports multiple attribution models. Each gives credit differently.

### First-touch attribution

**How it works:** 100% credit to the first channel that introduced the user.

**Best for:** Understanding discovery channels.

**Example:**

1. User finds you via Twitter (first touch)
2. Returns via Discord link
3. Converts via direct visit

→ Twitter gets 100% credit

### Last-touch attribution

**How it works:** 100% credit to the last channel before conversion.

**Best for:** Understanding what drives final conversions.

**Example:**

1. User finds you via Twitter
2. Returns via Discord link
3. Converts via direct visit (last touch)

→ Direct gets 100% credit

### Linear attribution

**How it works:** Credit split equally across all touchpoints.

**Best for:** Valuing the entire journey.

**Example:**

1. User finds you via Twitter
2. Returns via Discord link
3. Converts via direct visit

→ Each gets 33% credit

### Which model to use?

| Goal                 | Model       | Why                                      |
| -------------------- | ----------- | ---------------------------------------- |
| Grow awareness       | First-touch | Shows which channels introduce new users |
| Optimize conversions | Last-touch  | Shows what pushes users to convert       |
| Balanced view        | Linear      | Values the full journey                  |

## Part 5: How to Analyze Attribution in Formo

### View attribution in Overview

<Steps>
  <Step title="Go to Overview in the Formo Dashboard" />

  <Step title="See the Referrers chart in the tabs" />

  <Step title="Select different units (users, volume, revenue)" />
</Steps>

<Tip>You can apply filters on the overview page to see attribution by different segments.</Tip>

### Key metrics by source

For each traffic source, track:

| Metric               | What it tells you               |
| -------------------- | ------------------------------- |
| **Visitors**         | Reach/awareness                 |
| **Wallet connects**  | Engagement quality              |
| **Transactions**     | Conversion performance          |
| **Volume**           | Revenue contribution            |
| **Connect rate**     | Visitor → Wallet conversion     |
| **Transaction rate** | Wallet → Transaction conversion |

### Calculate true ROI

For paid campaigns, calculate cost per conversion:

```
Cost per Transaction = Campaign Spend / Transactions from Campaign
```

**Example:**

| Channel     | Spend   | Transactions | Cost/Transaction |
| ----------- | ------- | ------------ | ---------------- |
| Influencer  | \$5,000 | 100          | \$50             |
| Discord Ads | \$2,000 | 80           | \$25             |
| Twitter Ads | \$3,000 | 150          | \$20             |

In this example, Twitter Ads has the best ROI.

## Part 6: How to Create Attribution Reports

### Using Ask Formo for attribution analysis

Get quick attribution insights with Ask Formo (click **Ask Formo** in the sidebar):

**Channel comparison:**

> "Compare wallet connects by utm\_source for the last 30 days"

**Campaign performance:**

> "Show me transactions and volume by utm\_campaign this month"

**First vs last touch:**

> "What are the top 5 first-touch sources for users who transacted?"

**ROI analysis:**

> "Which utm\_source has the highest transaction volume per visitor?"

### Build an attribution dashboard

Create a dedicated attribution dashboard:

| Chart                    | Query                                   |
| ------------------------ | --------------------------------------- |
| **Visitors by Source**   | Daily visitors grouped by utm\_source   |
| **Conversion by Source** | Transaction rate by first-touch source  |
| **Revenue by Campaign**  | Volume grouped by utm\_campaign         |
| **Source Trend**         | Weekly wallet connects by top 5 sources |

### Attribution funnel

Create funnels filtered by source:

<Steps>
  <Step title="Go to Dashboards, click Create Chart, and select the Funnel chart type" />

  <Step title="Add steps: Visit → Connect → Transaction" />

  <Step title="Add breakdown by UTM Source" />

  <Step title="Compare conversion rates across channels" />
</Steps>

## Part 7: How to Optimize Your Marketing

### Identify your best channels

From your attribution data, categorize channels:

**High-volume, high-conversion:**

* Scale these immediately
* Allocate more budget
* Test similar channels

**High-volume, low-conversion:**

* Improve landing pages
* Refine targeting
* Test different messaging

**Low-volume, high-conversion:**

* Increase investment
* Find ways to scale
* Understand what makes them work

**Low-volume, low-conversion:**

* Reduce or cut spend
* Test improvements before continuing
* Consider audience mismatch

### Optimize by user quality

Don't just measure conversions. Measure user quality:

* Filter users by UTM source
* Compare average net worth by source
* Compare retention by source
* Compare volume per user by source

**Example insight:**

> Twitter drives more users, but Discord users have 3x higher average net worth and 2x better retention.

### Multi-touch optimization

If using linear attribution:

* Identify common multi-touch paths
* Ensure each touchpoint is optimized
* Don't cut channels that assist conversions

**Example path:**
Twitter (awareness) → DeFiLlama (research) → Direct (conversion)

All three channels contributed. Cutting Twitter would reduce DeFiLlama traffic.

## Part 8: Advanced Attribution Tactics

### Cross-channel attribution

Track users across marketing channels:

* Use consistent UTM naming
* Track first-touch and last-touch separately
* Analyze common paths with Flows

### Cohort-based attribution

Compare user quality by acquisition cohort:

* Create segments by first-touch source
* Measure retention for each segment
* Calculate LTV by acquisition source

**Example:**

| Source    | 30-day Retention | Avg LTV |
| --------- | ---------------- | ------- |
| Twitter   | 15%              | \$50    |
| Discord   | 25%              | \$120   |
| DeFiLlama | 35%              | \$200   |

## Attribution checklist

* [ ] UTM parameters on all social links
* [ ] UTM parameters on all email links
* [ ] UTM parameters on all partner links
* [ ] UTM parameters on all paid ads
* [ ] Referral codes on all partner and influencer links
* [ ] Consistent naming conventions
* [ ] Attribution dashboard created
* [ ] Weekly review of channel performance

## Summary

You've learned how to:

1. **Set up UTM tracking** across all marketing channels
2. **Set up referral tracking** with ref codes
3. **Understand attribution models** and when to use each
4. **Analyze attribution** in Formo with Overview
5. **Calculate true ROI** including conversion and user quality
6. **Optimize budget allocation** based on data

## Next Steps

* **[Key Metrics](/features/product-analytics/key-metrics)**: Deep dive on traffic analysis.
* **[Build Funnels](/guides/funnels)**: Build conversion funnels by source.
* **[Segment Wallets](/guides/wallet-segmentation)**: Target high-value user segments.
* **[Attribution Methodology](/data/attribution)**: Technical attribution details.

## FAQ

<AccordionGroup>
  <Accordion title="Does Formo capture UTM parameters automatically?">
    Yes. When a user lands on your app with UTM parameters in the URL, Formo captures them automatically and associates them with the user's session and wallet.
  </Accordion>

  <Accordion title="What happens if a user visits from multiple sources before converting?">
    Formo records both first-touch and last-touch attribution. You can view either model in the Overview page to understand the full user journey.
  </Accordion>

  <Accordion title="Can I use both UTM parameters and ref codes on the same link?">
    Yes. Combine them for full attribution: `?ref=alice&utm_source=twitter&utm_medium=social`. Both are captured independently.
  </Accordion>
</AccordionGroup>
