# Sales Tracking

E-commerce businesses require tracking actions like add to cart and purchases. Using UTM parameters and custom URL parameters to your links you can leverage your existing analytics platform (like Google Analytics) by using UTM-tags and custom parameters to capture conversion data.

{% hint style="info" %}
The concept is simple, by adding a tag to the link our customer will be able to filter their website traffic based on if the user has clicked on a product link sent by an ebbot AI Agent.
{% endhint %}

### Custom parameters

Custom parameters are query strings (like `?AI-agent` or `?product_id=123`) you add to a URL, they do not automatically populate standard reports like Source or Medium. To make them useful for analytics, they must be manually configured in a tag manager and registered in your analytics tool as a custom dimension for tracking.

**Base URL:** <mark style="background-color:$success;"><https://www.yourdomain.com/product1></mark>

**With custom parameter:** <mark style="background-color:$success;"><https://www.yourdomain.com/product1></mark><mark style="background-color:yellow;">?AI-agent</mark>

**With advanced custom parameter** <mark style="background-color:$success;"><https://www.yourdomain.com/product1></mark><mark style="background-color:yellow;">?AI-agent&</mark><mark style="background-color:purple;">product\_id=123</mark>

{% hint style="success" %}
If there is a way to add more specific information to the URL, such as the product ID, it will add another level of filtering for the customer.
{% endhint %}

### UTM-tags

UTM tags are a standardized set of five specific URL parameters (`utm_source`, `utm_medium`, `utm_campaign`, etc.) recognized by analytics platforms to automatically populate key reporting dimensions. They are the essential, structured method for overriding default attribution and measuring the traffic, source, and medium of external marketing efforts.

| **Parameter**  | **Recommended Value (Example)**  | **Purpose**                                                                              |
| -------------- | -------------------------------- | ---------------------------------------------------------------------------------------- |
| `utm_source`   | `AI-agent` (or your AI's name)   | Identifies the software/platform that generated the link.                                |
| `utm_medium`   | `chat` (or `ai-response`)        | Identifies the *type* of interaction or channel used to deliver the link.                |
| `utm_campaign` | `organic-link` (or `user-query`) | Provides a grouping term for all links generated by the LLM in non-promotional contexts. |

**Base URL:** <mark style="background-color:$success;"><https://www.yourdomain.com/product1></mark>

**With UTM-tag:** <mark style="background-color:$success;"><https://www.yourdomain.com/product1></mark><mark style="background-color:yellow;">?utm\_source=AI-agent\&utm\_medium=chat\&utm\_campaign=organic-link</mark>

{% hint style="info" %}
The recommended values are just suggestions and can be set to whatever the customer prefers.
{% endhint %}

## How to add custom parameters or UTM-tags to links

#### Use the source transformer

Using the transformer you can create a rule that adds parameters to every link in a source. For example, in the URL-column always add ?AI-agent in the end of the text. Below is one example of how to do it. For more information about the transformer [click here](/ebbot-docs/core-capabilities/ebbotgpt/ebbotgpt-knowledge/knowledge-pre-processing/advanced-transformer-settings.md).

Replace '<mark style="background-color:yellow;">url</mark>' with the name of the column containing the link.\
Replace '<mark style="background-color:yellow;">?AI-agent</mark>' with the custom parameter you want added to the link.

```
  {
    "type": "put",
    "value": {
      "type": "concat",
      "values": [
        {
          "type": "get",
          "source": "url"
        },
        {
          "type": "value",
          "value": "?AI-agent"
        }
      ]
    },
    "target": {
      "type": "value",
      "value": "url"
    }
  },

```

**Without transformer:** <https://www.yourdomain.com&#x20>;

**With transformer:** <https://www.yourdomain.com><mark style="background-color:yellow;">?AI-agent</mark>

#### Prompt the AI-agent&#x20;

Write instructions in the persona that every time the AI-agent sends a product link it should add `?AI-agent` at the end of the link.


---

# 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.ebbot.ai/ebbot-docs/core-capabilities/ebbotgpt/ebbotgpt-best-practices/sales-tracking.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.
