# Map lead attribution to contact fields

You'll save campaign details and the original referrer to contact fields, so you can see where your leads came from.

See which campaigns brought leads to your website by saving their UTM values and original referrer in your email platform or CRM. You can keep a contact's existing attribution or let later visits update it.

You'll need a [connected provider](https://rightmessage.com/help/topics/esps-and-crms) that can write custom fields, permission to edit the project, and the snippet on your website. Create suitable text fields in your provider, or use the [field picker's creation option](https://rightmessage.com/help/synchronizing-contact-data-with-your-email-platform-or-crm) if it's available.

## Choose where to save the campaign details

1. Open **Settings**, then **Attribution**. The page is titled **Lead Attribution**.
2. Choose a custom field for **UTM Source**, such as `lead_source`.
3. Map the other values you'd like to keep. The remaining cards are **UTM Medium**, **UTM Campaign**, **UTM Term**, **UTM Content**, and **Referrer**.
4. On each mapped card, leave **Overwrite?** off to preserve an existing field value. Turn it on if you'd like to replace that value when the captured value differs.
5. Review and [publish your changes](https://rightmessage.com/help/publishing-your-changes).

![Lead attribution mappings for UTM source, medium, campaign, term, content and referrer](https://rightmessage.com/help/screens/settings-attribution.light.webp)

Each card starts without a field selected and with **Overwrite?** off. Unmapped cards are dimmed. If you haven't connected a provider, the controls are disabled. Attribution destinations use custom fields, not native contact fields.

## Know which visit the data comes from

The UTM cards read `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, and `utm_content` from page URLs.

For each key, RightMessage uses the current page's value if there is one. Otherwise, it uses the most recent recorded value for that key. This means the five values can come from different pageviews. Visiting a page without UTM parameters doesn't clear them all.

**Referrer** comes from the first recorded pageview. It's separate from the most recent referring page or the arrival source in **Activity**.

**Overwrite?** controls whether an existing contact field can change. It doesn't choose a first-touch or last-touch session, or change which pageview supplies the value. Condition rules have their own [UTM occurrence choices](https://rightmessage.com/help/conditions-utm).

## Check a contact's saved attribution

1. Open a clean browser and visit a real page on your website with UTM parameters added.
2. Complete your configured signup or [identification steps](https://rightmessage.com/help/how-do-we-identify-returning-subscribers-or-contacts) with a test contact you control.
3. Find that contact in your email platform and check the mapped fields.
4. Repeat with a different campaign value for an existing test contact.
5. Check that a field with **Overwrite?** off keeps its existing value, while a field with it on accepts the changed value.

For example, [WorkForge](https://workforge.rightmessage.com) could test `https://workforge.rightmessage.com/?utm_source=newsletter&utm_medium=email&utm_campaign=remote_teams`. Use a page on your own website with the campaign values you'd like to test.

When the contact record has the expected campaign values and follows your overwrite choices, attribution is working. If something is missing or different, use [contact-sync troubleshooting](https://rightmessage.com/help/troubleshoot-contact-sync).
