# Set Custom Visitor Properties with the Pageview API

Use custom visitor properties in the Pageview API to send visitor-specific attributes to Crobox.

This supports targeting, analytics, and advanced personalization use cases.

```javascript
window.crobox = window.crobox || [];

crobox.push(function(crobox) {
  // The Crobox API is now initialized and methods are available
  crobox.pageview({
    pt: crobox.PAGE_INDEX,
    lc: "en-GB",
    // The cp field lets you send custom visitor properties
    cp: {
      vip: true
    }
  });
});
```

### Configuring Custom Properties in the Crobox App

After implementing the code above, complete the setup in the Crobox app:

1. Go to **Settings** > **Visitor Properties**.
2. Click **Create New Property**.
3. **Name the property** using the same key you send in your `pageview()` call, for example `vip`.
4. **Set the property type** to match the value you send, for example **boolean** for `true` or `false`.

### Using Custom Visitor Properties in Crobox

After setup, you can use custom visitor properties in three main ways:

* **Targeting visitors**: Segment and personalize experiences based on business-specific attributes. For example, show a specific campaign only to visitors where `vip = true`.
* **Filtering in analytics**: Filter reports and dashboards using these properties to analyze behavior by visitor segment.
* **Supporting custom enterprise use cases**: Enterprise customers can also use custom visitor properties for advanced mappings. For example, if a pageview event identifies a visitor as `vip`, Crobox can map that value to VIP pricing in a Product Finder or other Crobox experiences.

{% hint style="info" %}
Contact your Account Manager if you need help defining properties or setting up custom mappings.
{% endhint %}

### FAQ

<details>

<summary>What happens if I send a custom property in <code>pageview()</code> but don’t define it in the Crobox Admin interface?</summary>

The property will not be recognized or usable for targeting or analytics. To activate a custom property, you must create a matching **Visitor Property** in the Crobox panel under **Settings > Visitor Properties**, using the **exact same key** and specifying the correct **value type** (e.g. string, boolean, number).

</details>

<details>

<summary>Can I update a visitor’s custom property value after the first pageview?</summary>

Yes. The value of a custom visitor property can be **overwritten** by subsequent `pageview()` calls. The latest value sent for that property will be associated with the visitor moving forward.

</details>

<details>

<summary>How do custom visitor properties differ from Crobox’s built-in targeting criteria (e.g. location, device, language)?</summary>

Built-in properties are automatically collected by Crobox and require no setup, while **custom visitor properties** are **manually defined and implemented** via the `cp` field in the `pageview()` API. They enable you to extend targeting to business-specific attributes (e.g. subscription level, gender preference, login status) that Crobox wouldn’t otherwise know.

</details>

<details>

<summary>Can custom visitor properties be used in other Crobox experiences?</summary>

Yes. Standard use cases include targeting and analytics. Enterprise setups can also support custom mappings for Product Finders and other Crobox experiences. For example, a `vip` value sent in `pageview()` can be used to support VIP pricing logic or other segment-specific experiences.

</details>


---

# 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.crobox.com/technical-documentation/setting-custom-visitor-properties-with-pageview-api.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.
