# Visit events

To measure the available inventory for ads, it is necessary to send the contextual information related to each placement defined during the setup of your account. In a client-side integration, triggering this event will display the ads.

The table below lists the different possible page types along with their corresponding codes :

| Placement            | Code   |
| -------------------- | ------ |
| Homepage             | home   |
| Hub navigation page  | hub    |
| Search result page   | search |
| Product listing page | plp    |
| Product detail page  | pdp    |

## Homepage

The following event should be fired for the **home** placement:

{% tabs %}
{% tab title=" EXAMPLE" %}

<pre class="language-javascript"><code class="lang-javascript">&#x3C;script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
<strong>  window.vzbl_q.push({
</strong>    event: "visit",
    value: {
      placement: "home",
      alias: "233eca12ac66bd99b410dae07ca910d9"
    }
  });
&#x3C;/script>
</code></pre>

{% endtab %}
{% endtabs %}

## Search result page

The following event should be fired for the **search** placement:

{% tabs %}
{% tab title="MINIMAL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "search",
      search_terms: "smart home device"
    }
  });
</script>
```

{% endtab %}

{% tab title="FULL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "search",
      search_terms: "smart home device",
      alias: "233eca12ac66bd99b410dae07ca910d9",
      listed_products: {
        ids: ["skuPos1", "skuPos2", "skuPos3", "skuPos4"],
        total: 2872,
        page: 1,
        sort: "popularity",
        filters: [
          {code: "color", op: "in", value: ["red", "blue"]},
          {code: "seller", op: "eq", value: "ACME NG"},
          {code: "price", op: "lte", value: 299.99},
          {code: "rating", op: "gt", value: 3.5}
        ]
      }
    }
  });
</script>
```

{% endtab %}
{% endtabs %}

## Product listing page

The following event should be fired for the **plp** placement:

{% tabs %}
{% tab title="MINIMAL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "plp",
      category: "c29023"
    }
  });
</script>// Some code
```

{% endtab %}

{% tab title="FULL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "plp",
      category: "c29023",
      alias: "233eca12ac66bd99b410dae07ca910d9",
      listed_products: {
        ids: ["skuPos1", "skuPos2"],
        total: 287,
        page: 2,
        sort: "price_asc",
        filters: [
          {code: "color", op: "eq", value: "white"},
          {code: "free_delivery", op: "eq", value: true},
          {code: "price", op: "lt", value: 99.99},
          {code: "rating", op: "gte", value: 4}
        ]
      }
    }
  });
</script>
```

{% endtab %}
{% endtabs %}

## Product detail page

The following event should be fired for the **pdp** placement:

{% tabs %}
{% tab title="MINIMAL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "pdp",
      product: {
        id: "sku910d",
        categories: ["c290", "c2902", "c29023"]
      }
    }
  });
</script>
```

{% endtab %}

{% tab title="FULL EXAMPLE" %}

```javascript
<script type="text/javascript">
  window.vzbl_q = window.vzbl_q || [];
  window.vzbl_q.push({
    event: "visit",
    value: {
      placement: "pdp",
      alias: "233eca12ac66bd99b410dae07ca910d9",
      product: {
        id: "sku910d",
        categories: ["c290", "c2902", "c29023"],
        price: 456.90,
        availability: "in stock",
        rating: 4.2,
        reviews: 168
      }
    }
  });
</script>
```

{% endtab %}
{% endtabs %}

<table><thead><tr><th>Parameters</th><th width="338.3333333333333">Description</th><th>Mandatory </th></tr></thead><tbody><tr><td>placement</td><td><p>The code of the type of page visited / location</p><p><em><mark style="background-color:blue;">Example: "home", "search", "plp", "pdp"</mark></em></p></td><td><strong>YES</strong></td></tr><tr><td>search_terms</td><td><p>The keywords searched by the user</p><p><em><mark style="background-color:blue;">Example: "my search terms"</mark></em></p></td><td>YES (search)</td></tr><tr><td>category</td><td><p>The main category id of the product listing page</p><p><em><mark style="background-color:blue;">Example: "cat1302"</mark></em></p></td><td>YES (plp)</td></tr><tr><td>product.id</td><td><p>The product identifier of the product detail page</p><p><em><mark style="background-color:blue;">Example: "pid9123374"</mark></em></p></td><td>YES (pdp)</td></tr><tr><td>product.categories</td><td><p>Identifiers of product categories</p><p><em><mark style="background-color:blue;">Example: ["cat1", "cat13", "cat1302"]</mark></em> </p></td><td>YES (pdp)</td></tr><tr><td>listed_products.ids</td><td><p>A table containing the identifiers of the products present on the current page</p><p><em><mark style="background-color:blue;">Example: ["pid1", "pid23", "pid372"]</mark></em> </p></td><td>NO (search, plp)</td></tr><tr><td>alias</td><td>The customer identifier transformed with a hash function (MD5, SHA-256)</td><td>NO</td></tr></tbody></table>


---

# 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.veasybl.io/en/visit-events.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.
