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

# Set member attributes

> Set member attributes in Memberful to store custom data on each member's profile, such as cohort, source, or any other field useful to your team.

Member attributes let you store UTM and other custom data on a member's profile. You can use them to track campaign sources and other information about your members.

In this help article, we'll show you how to add UTM and custom tracking parameters and where Memberful collects them.

## Set up UTM parameters

UTM parameters ( `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`) are tags that you can add to a URL to track where your members came from. You can generate these URLs with [Google's URL builder](https://ga-dev-tools.appspot.com/campaign-url-builder/).

You can add the UTM parameters to a URL pointing to your site or a specific plan purchase link. For example, this link would tell you which members visited your site from a specific Twitter campaign:

```text theme={null}
https://YOURSITE.com?utm_campaign=springpromo&utm_medium=social&utm_source=twitter
```

## Set up tracking parameters

You can also track custom parameters (such as the number of viewed pages or some other custom data). There are three ways to do this.

**A) Via JavaScript**

Insert a JavaScript function called `memberfulTrackingData()` into the page that contains the plan purchase link.

```html theme={null}
<script>
function memberfulTrackingData(parameters) {
  parameters.SomeTrackingParameter = "Some value";
  return parameters;
}
</script>
```

Replace `SomeTrackingParameter` with the name of the tracking parameter you want to track, and `Some value` with the data you want to assign for this member's parameter.

On page load, Memberful adds stored tracking parameters to links to Memberful. If you define `memberfulTrackingData()`, Memberful passes the parameters to the function and uses its returned values on those links. The function changes the link URLs; it doesn't change the values stored in the visitor's browser. You can add the current page to help identify where a visitor clicked through from, but this approximates the page they clicked from rather than providing a complete last-touch history.

**B) Via query strings on a plan purchase link**

Add tracking parameters directly to a [plan purchase link](https://memberful.com/docs/plans/promote-and-sell/add-a-link-to-buy-a-plan.md) via query strings.

Start with a regular plan purchase link.

```text theme={null}
https://ACCOUNT-URL.memberful.com/checkout?plan=12345
```

Add an ampersand (`&`) symbol, and for each parameter you'd like to track, add `mt_` followed by the name of the parameter, and then an equal sign (`=`) followed by the value you'd like to assign to that parameter. You can replace spaces with plus signs (`+`). The final result should look like this:

```text theme={null}
https://ACCOUNT-URL.memberful.com/checkout?plan=12345&mt_SomeTrackingParameter=Some+value
```

Repeat this process for each parameter you'd like to track.

**C) Through a hidden parameter in a form**

To use tracking parameters with a form like [the Choose What You Pay form we show in our docs](https://memberful.com/docs/plans/plan-options/enable-choose-what-you-pay.md), add a hidden input with a name that starts with `mt_` followed by the name of the parameter.

```html theme={null}
<input type="hidden" name="mt_SomeTrackingParameter" value="Some value" />
```

For this to work, the "action" attribute of the form should lead to the plan purchase URL.

For tracking parameters to work, you must have integrated Memberful with your website by following the instructions at *Website → Settings.*

## Where does Memberful collect these parameters?

During checkout, Memberful collects the tracking parameters passed through on the purchase link and displays them as **Attributes** in the member's profile.

![Member attributes](https://mintcdn.com/memberful/4eo498UnQhX-7VGZ/images/tracking/set-member-attributes/member-attributes.png?fit=max\&auto=format\&n=4eo498UnQhX-7VGZ\&q=85\&s=f2db587e28f0cb035963547ce1886f0a)

On sites with the Memberful script, UTM and `referral_code` values in a page's URL are stored in browser local storage for that site. A later page visit updates the stored value for each matching key, so the final set may combine values from different visits.

The `referrer` value is set on the first visit and isn't overwritten on later visits in the same browser. If a visitor switches browsers or devices, or clears browser data before signing up, Memberful can set a new `referrer` value. Browser policies vary, but local storage typically remains unless the visitor clears it.

Member attributes, except for custom parameters, are also included in the **Members CSV export**, which you can generate from the **Members** tab. If you've configured the [Google Analytics integration](https://memberful.com/docs/metrics-and-analytics/tracking/integrate-with-google-analytics.md), Memberful passes custom parameters to Google Analytics.


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