> 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/developer-guide/api-guide/custom-data.md). Agents can also search and read this documentation through its [MCP server](https://docs.groobee.ai/~gitbook/mcp).

# カスタムデータ

## **1. 概要**

* REST APIを使い、memberId をもとに自社のカスタムデータを管理して、セグメントで活用するときに使います。

***

## **2. 主な機能**

* カスタムデータを使うと、自社で保有しているデータをgroobeeと連携し、希望する条件に合う顧客をターゲティングできます。
* カスタムデータは最大30個まで追加できます。新しいデータが必要な場合は、使っていないデータを削除してください。

**カスタムデータ変数の活用例**

| **データ項目（例）**       | **タイプの例**  | **データ形式**   | **活用方法**                                       |
| ------------------ | ---------- | ----------- | ---------------------------------------------- |
| 購入相談の申込履歴          | Y/N        | 文字列（String） | 購入相談の申込履歴がある会員をターゲティング                         |
| 会員の誕生月             | mm         | 数値（Int）     | 誕生月ごとに顧客をターゲティング                               |
| 会員の性別              | M/F        | 文字列（String） | 男性または女性をターゲティング                                |
| 会員登録日              | yyyy-mm-dd | 日付（Date）    | 例：2024-01-01\~2024-03-31 の第1四半期に登録した会員をターゲティング |
| アプリの初回ログイン日        | yyyy-mm-dd | 日付（Date）    | アプリの初回ログイン日があるかどうかで、アプリのインストール有無を判断            |
| SMSマーケティングの受信同意    | Y/N        | 文字列（String） | SMSの受信に同意していない会員に、受信同意を促すオンサイトマーケティング          |
| プッシュ通知マーケティングの受信同意 | Y/N        | 文字列（String） | プッシュ通知の受信に同意していない会員に、受信同意を促すオンサイトマーケティング       |
| クーポン名              | 例）240401   | 文字列（String） | 発行したクーポン名と、下のクーポン使用有無の値をAND条件にしてキャンペーンに活用      |
| クーポン使用有無           | Y/N        | 文字列（String） | クーポンを使用していない顧客を対象にしたキャンペーンに活用                  |
| 会員ランク（メンバーシップ）     | 会員ランク      | 文字列（String） | 複数選択、またはランク別・NORMAL（ランクなし）の会員を対象にしたイベントの告知     |
| 従業員かどうか            | Y/N        | 文字列（String） | 従業員を除外、または従業員だけをターゲティング                        |

***

## **3. カスタム：イベントとデータ**

* カスタムイベントとカスタムデータは、groobeeが標準で提供するセグメント変数のほかに、条件を自由に組み合わせて顧客をターゲティングするときに使います。
* 2つの方式の違いは次のとおりです。

|              | **カスタムイベント**                                                                                         | **カスタムデータ**                                           |
| ------------ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| データ連携方法      | JavaScript                                                                                           | REST API & JavaScript                                 |
| データ連携のタイミング  | 自社サイトを訪れた顧客が特定の行動をしたとき                                                                               | 任意のタイミング                                              |
| 活用範囲         | <p>1. セグメントターゲティングの変数として活用</p><p>2. オンサイトキャンペーン作成時の表示条件の設定<br>オンサイトキャンペーン：ステップ3 オプション設定 > トリガー条件</p> | セグメントターゲティングの変数として活用                                  |
| 自社サイトに合う方式は？ | <p>自社で蓄積したデータはないが、groobeeと連携して、希望する条件に合う顧客をターゲティングしたい。</p><p>→ カスタムイベント</p>                          | <p>自社で保有しているデータを使って顧客をターゲティングしたい。</p><p>→ カスタムデータ</p> |

***

<br>

## **4. カスタムデータの利用手順**

* カスタムデータを使うには、次の手順で進めてください。

### **ステップ1**

* [**\[設定 > サイト > キー管理\]**](https://docs.groobee.ai/ja/admin/settings/site.md#id-2)でAPIキーを発行してください。<br>

<figure><img src="https://files.helpdocs.io/p92xn84cjv/articles/yivwiwptap/1713875025179/image.png" alt=""><figcaption></figcaption></figure>

### **ステップ2**

* [**\[設定 > カスタム設定 > データ\]**](https://docs.groobee.ai/ja/admin/settings/custom.md#undefined-1)のページを参照して、データを追加してください。

{% hint style="warning" %}
データを作成した後、groobeeが提供するカスタムデータ REST APIを呼び出してデータの値をgroobeeに送信すると、カスタムデータを使ったターゲティングができるようになります。
{% endhint %}

### **ステップ3**

* REST APIの呼び出し：groobeeが提供するカスタムデータ連携 REST APIを呼び出し、データキーとデータの値を送信してください。
* バックエンドからは、HTTPS通信ができるクライアントライブラリであれば、どれでも呼び出せます。
  * HttpsUrlConnection(Java)
  * Requests(Python)
  * Faraday(Ruby)
  * net/http(Ruby, Go)
  * Guzzle(PHP)\
    など、さまざまなバックエンド通信クライアントライブラリ
* JavaScriptでは、ajax、fetch、axiosなど、ヘッダーを設定できるAPI通信ライブラリを使って呼び出せます。

{% hint style="info" %}
[カスタムデータ v2.0.1](https://docs.groobee.ai/ja/developer-guide/api-guide/custom-data/v2.md) のページを確認してください。
{% endhint %}

\ <br>


---

# 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/developer-guide/api-guide/custom-data.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.
