# Tracking UTM parameters

By default UTM parameters and not tracked in any way, they are even removed from the saved URL so that the number of unique links stored is reduced.

If you want to store the UTM params for each session, you can automatically [tag](/api/tags.md) each session with the name and value of each UTM parameter. Add this after the tracking snippet:

{% code title="Store UTM parameters as tags" %}

```html
<script>
(function() {
function getParameterByName(name, url = window.location.href) {
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

var utms = ['utm_source', 'utm_medium', 'utm_campaign'];
utms.forEach(function(utm) {
   var val = getParameterByName(utm);
   val && UST.addTag(utm + ':' + val);
});
})();
</script>
```

{% endcode %}

{% hint style="info" %}
Once you have stored the utm parameters as tags you can create segments and filter sessions based on those tags.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uxwizz.com/useful-examples/tracking-utm-parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
