> For the complete documentation index, see [llms.txt](https://docs.groobee.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groobee.ai/ja/segments/segment/variable/custom.md). Agents can also search and read this documentation through its [MCP server](https://docs.groobee.ai/~gitbook/mcp).

# セグメント変数：カスタム

### **カスタムイベント**

設定画面で作成したカスタムイベントを使って訪問者をターゲティングします。

**時点**

* 過去：期間内にカスタムイベントを発生させた訪問者
* 現在：現在のセッションでカスタムイベントを発生させた訪問者

**変数の使用例**

レビュー投稿時に呼び出すイベントで、データタイプ「数値（Int）」を選び、値に「3」を入力した場合

* *以上*：レビューの投稿数が3件以上の訪問者をターゲティング
* *以下*：レビューの投稿数が3件以下の訪問者をターゲティング
* *と等しい*：レビューの投稿数が3件の訪問者をターゲティング
* *でない場合*：レビューの投稿数が3件の訪問者を除いてターゲティング

レビューの投稿数 \[3\~5]件

* *範囲内*：レビューの投稿数が3件以上5件以下の訪問者をターゲティング
* *範囲外*：レビューの投稿数が3件以上5件以下の訪問者を除いてターゲティング

***

### **カスタムデータ**

設定画面で作成したカスタムデータを使って訪問者をターゲティングします。

**時点**

* 「過去」「現在」の時点にかかわらず、キャンペーンが表示された時点でカスタムデータの履歴がある訪問者

**変数の使用例**

クーポン数で、データタイプ「数値（Int）」を選び、値に「1」を入力した場合

* *以上*：クーポンを1枚以上保有している訪問者をターゲティング
* *以下*：クーポンを1枚以下保有している訪問者をターゲティング
* *と等しい*：クーポンを1枚保有している訪問者をターゲティング
* *でない場合*：クーポンを1枚保有している訪問者を除いてターゲティング

クーポン数に「1\~5」を入力した場合

* *範囲内*：クーポンを1枚以上5枚以下保有している訪問者をターゲティング
* *範囲外*：クーポンを1枚以上5枚以下保有している訪問者を除いてターゲティング

**日付型カスタムデータの月単位の条件**

データタイプが日付（Date）のカスタムデータでは、月単位で対象を指定できます。基準となる月は判定のたびに日本時間で計算し直されるので、毎月値を送り直さなくても対象が自動で切り替わります。

* 年月を基準：今月を基準に、n か月前の1か月間（過去）、今月（現在）、n か月後の1か月間（未来）にあたる日付を持つ訪問者をターゲティングします。たとえば、登録日で過去1か月を選ぶと、11月には10月の登録者、12月には11月の登録者が対象になります。
* 月を基準(年は無視)：年に関係なく、同じ月にあたる日付を持つ訪問者をターゲティングします。たとえば、誕生日で現在を選ぶと、11月には11月生まれ、12月には12月生まれの訪問者が対象になります。
* n には1\~120の数値を入力します。1を入力すると先月または来月になります。
* ターゲット設定の期間設定は、カスタムデータの条件には影響しません。

<figure><img src="https://2476765724-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FojazvrSJySxAAO80FxSG%2Fuploads%2FibROkBPv4zDtyaEKV57J%2Fja_149.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2476765724-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FojazvrSJySxAAO80FxSG%2Fuploads%2FenZEd3F8TjCm4OfZPAay%2Fja_150.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}

* 月単位の条件は、日付型のカスタムデータでのみ使用できます。文字列として収集しているキーには使用できないため、日付型のキーを新しく作成し、全会員の値を yyyy-MM-dd 形式で送ってください。形式が異なる値は収集されません。
* 値がすべて収集されるまでは、値のない会員は条件の対象から外れます。全会員の値が揃ってからキャンペーンを開始してください。
* 誕生日のように年がわからない値は、任意の年で送ってもかまいません。月を基準(年は無視)の条件では年を参照しません。
  {% endhint %}

**Tip & Guide**

* カスタムデータは設定画面で追加できます。
* カスタムデータは最大30個まで作成できます。
* 追加したカスタムデータの値をgroobee APIの呼び出しで渡さないと、条件は動作しません。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groobee.ai/ja/segments/segment/variable/custom.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
