> For the complete documentation index, see [llms.txt](https://fredhopper.gitbook.io/product-discovery/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fredhopper.gitbook.io/product-discovery/tracking-and-sending-events/activities/click.md).

# Click

Track click actions on your platform, such as product, facet, campaign, or recommendation clicks. Use these events to link impressions to views and calculate conversion rates.

**Click** actions are the primary way that users interact with your platform. They can be performed on various features and are integral for calculating **conversion rates** as they are used to link **impressions** to **views**.

* [Click on a product](#click-on-a-product) (**FHR** and **XO**)
* [Click on a facet ](#click-on-a-facet)(**FHR** only)
* [Click on an item campaign](#click-on-a-product-from-a-campaign) (**FHR** only)
* [Click on a recommendation ](#click-on-a-recommendation)(**XO Recommendations** only)

## Click on a product <a href="#click-on-a-product" id="click-on-a-product"></a>

When a user navigates to a [PDP ](/product-discovery/tracking-and-sending-events/acronyms-and-abbreviations.md)from a [PLP](/product-discovery/tracking-and-sending-events/acronyms-and-abbreviations.md), you should send a **click** event.

{% hint style="info" %}
For implementations with [**infinite scroll**](/product-discovery/tracking-and-sending-events/activities/activity-object.md#handling-infinite-scroll), each request for data should trigger a new event. The **source ID** should come from the response of the triggering request.
{% endhint %}

### Properties

```javascript
{
    "action":"click",
    "target": {
        "product": "product-id"
    },
    "sourceId":"source-id",
    "metadata": {}
}
```

| Property           | Context                                           | Descirption                                                                                                                                                                                                                            |
| ------------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action`           | All                                               | Must be specified as "click"                                                                                                                                                                                                           |
| `target.product`   | All                                               | The ID of the clicked product, i.e. `secondid` [in the FHR query response](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping)                                                          |
| `sourceId`         | All                                               | The [ID that links the FHR or XO response to the event](/product-discovery/tracking-and-sending-events/activities/activity-object.md#source-id), i.e. response ID (`rid` in the FHR response query and `id` for XO response query)     |
| `metadata.*`       | All                                               | Additional information, such as **context** or **locale**                                                                                                                                                                              |
| `metadata.query`   | The click is triggered on search results          | The search terms that generated the viewed search results; the search term is available [in the FHR response query](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping) (`searchterms`) |
| `metadata.suggest` | XO only: The click is triggered on search results | A boolean that describes if the search results are powered by Search Suggest                                                                                                                                                           |

<details>

<summary>Example: Click on a product</summary>

```json
{
    "action":"click",
    "target": {
        "product":"83647582"
    },
    "sourceId":"6266c5de-6a3c-4299-af78-3fd17dc3e787",
    "metadata": {
        "locale": "en_GB"
    }
}
```

</details>

## Click on a facet <a href="#click-on-a-facet" id="click-on-a-facet"></a>

{% hint style="info" %}
Only **FHR** customers need to track this action.
{% endhint %}

When a user clicks on a **facet**, you should send a **click** event.

### Properties

```json
{
    "action": "click",
    "target": {
        "facet": "facet-id",
        "facet-id": "facet-value"
    },
    "sourceId": "source-id",
    "metadata": {}
}
```

| Property            | Context | Description                                                                                                                                                                                                                                                                                 |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action`            | All     | Must be specified as "click"                                                                                                                                                                                                                                                                |
| `target.facet`      | All     | The ID of the active facet, i.e. `universes.universe.facetmap.filter[where .seleceted == "true"].facetid` [in the FHR response query](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping)                                                    |
| `target.[facet-id]` | All     | The value of the active facet, i.e. `universes.universe.facetmap.filter[where .seleceted == "true"].filterselection[where .seleceted == "true"].value.value` [in the FHR response query](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping) |
| `sourceId`          | All     | The [ID that links the FHR response to the event](/product-discovery/tracking-and-sending-events/activities/activity-object.md#source-id), i.e. response ID (`rid` in the FHR response query)                                                                                               |
| `metadata.*`        | All     | Additional information, such as **locale**                                                                                                                                                                                                                                                  |

<details>

<summary>Example: Click on a facet</summary>

```json
{
  "action": "click",
  "target": {
    "facet": "28f909c0-332b-4afd-bd75-1e0e793e1984",
    "28f909c0-332b-4afd-bd75-1e0e793e1984": "red"
  },
  "sourceId": "8efbbef2-6640-4c16-b263-1f5a84813a1c",
  "metadata": {
    "locale": "en_GB"
  }
}
```

</details>

## Click on a campaign <a href="#click-on-a-product-from-a-campaign" id="click-on-a-product-from-a-campaign"></a>

{% hint style="info" %}
Only **FHR** customers need to track this action.
{% endhint %}

When a user clicks on a product displayed as part of an **item campaign** powered by FHR, you should send a **click** event.

### Properties

```json
{
    "action":"click",
    "target": {
        "product": "product-id",
        "campaign": "campaign-id"
    },
    "sourceId":"source-id",
    "metadata": {}
}
```

| Property          | Context | Description                                                                                                                                                                                    |
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action`          | All     | Must be specified as "click"                                                                                                                                                                   |
| `target.product`  | All     | The ID of the clicked product, `secondid` [in the FHR response query](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping)                       |
| `target.campaign` | All     | The ID of the clicked campaign, i.e. `themes[x].theme[i].id` in [in the FHR response query](/product-discovery/tracking-and-sending-events/activities/activity-object.md#fhr-response-mapping) |
| `sourceId`        | All     | The [ID that links the FHR response to the event](/product-discovery/tracking-and-sending-events/activities/activity-object.md#source-id), i.e. response ID (`rid` in the FHR response query)  |
| `metadata.*`      | All     | Additional information, such as **locale**                                                                                                                                                     |

<details>

<summary>Example: Click on a campaign</summary>

```json
{
    "action":"click",
    "target": {
        "product": "83647582",
        "campaign": "41234266-cf17-4ed3-8423-fbd029a3d7ae"
    },
    "sourceId":"8efbbef2-6640-4c16-b263-1f5a84813a1c",
    "metadata": {
        "locale": "en_GB"
    }
}
```

</details>

## Click on a recommendation <a href="#click-on-a-recommendation" id="click-on-a-recommendation"></a>

{% hint style="info" %}
Only **XO Recommendations** customers need to track this action.
{% endhint %}

When a user clicks on a product that is the **result of a recommendation widget**, you should send a **click** event.

### Properties

```json
{
    "action": "click",
    "target": {
        "product": "product-id"
    },
    "sourceId": "source-id",
    "metadata": {
        "widgetId": "widget-id"
    }
}
```

| Property            | Context | Description                                                                                                                                                                                                                                                   |
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action`            | All     | Must be specified as "click"                                                                                                                                                                                                                                  |
| `target.product`    | All     | The ID of the clicked product                                                                                                                                                                                                                                 |
| `sourceId`          | All     | The [ID that associates the XO response with the event](/product-discovery/tracking-and-sending-events/activities/activity-object.md#source-id); this should correspond to the response that provided the recommendations; i.e. `id` in the XO response query |
| `metadata.*`        | All     | Additional information, such as **context**                                                                                                                                                                                                                   |
| `metadata.widgetId` | All     | The ID of the widget serving the recommendation available in the URL                                                                                                                                                                                          |

<details>

<summary>Example: Click on recommendation</summary>

```json
{
 "action": "click",
 "target": {
   "product": "83647582"
 },
 "sourceId": "ec1851da-bff2-495c-b757-c162d9a079bd",
 "metadata": {
   "widgetId": "5f0dfaf1c79a47fd982fb17de6533cf3"
 }
}
```

</details>
