# Segmentの統合（レガシー）

注記

これはレガシー統合です。 新しい Twilio Segmentのパススルー統合については、 [「Twilio Segmentの統合」を参照してください](https://support.optimizely.com/hc/en-us/articles/20900689591437)。

Optimizely Data Platform (ODP) とSegmentの統合により、Segmentで収集されたイベントやその他の顧客データを ODP にインポートできます。

### Segmentの構成 <a href="#gjdgxs" id="gjdgxs"></a>

ODP Segment統合を有効にします。

1. **\[Account設定] > \[統合] > \[Segment]**&#x306B;移動します。
2. **\[Segmentを有効にする]**&#x3092;オンに切り替えます。
3. **\[サインイン]**&#x3092;選択し、Segmentのプロンプトに従います。

![Enable\_and\_Sign\_into\_Segment.png](/files/WXhTIKNySyOSc75xolIw)

注記

ブラウザに広告ブロックまたはコンテンツブロック ソフトウェアがインストールされている場合は、「**サインイン」のオプションが表示されない場合があります**。 表示されない場合は、ブロック技術をオフにしてページを更新してください。

### データ詳細 <a href="#id-30j0zll" id="id-30j0zll"></a>

ODP は、Segment.io の次のイベント タイプと各イベント タイプに関連付けられた標準フィールドを使用して、対応する ODP イベントを自動的に作成します。

* [識別する](https://support.optimizely.com/hc/en-us/articles/4407269169805-Integrate-Segment-Legacy#h_b634323b-ecaa-4c36-842a-3e7fc3fe8148)
* [追跡](https://support.optimizely.com/hc/en-us/articles/4407269169805-Integrate-Segment-Legacy#h_b5afc15d-7b0d-4c35-b6f1-bbbe347e18fb)
* [ページ/画面](https://support.optimizely.com/hc/en-us/articles/4407269169805-Integrate-Segment-Legacy#h_2a54c240-69c7-4acc-9211-580b2ada90cd)
* [Eメール](https://support.optimizely.com/hc/en-us/articles/4407269169805-Integrate-Segment-Legacy#h_2618b623-1b37-4aa2-bd61-fc8ecae49d4e)

以下の表は、Segment.io の共通フィールドと、ODP イベントの対応するフィールドの概要を示しています。

| **Segmentフィールド**         | **ODPフィールド**           |
| ------------------------ | ---------------------- |
| anonymousID              | segment\_anonymous\_id |
| userID                   | segment\_user\_id      |
| timestamp                | ts                     |
| context.locale           | language               |
| context.page.path        | page                   |
| context.referrer.url     | referrer               |
| context.page.search      | search\_term           |
| context.page.title       | title                  |
| context.page.url         | hostname               |
| context.ip               | ip                     |
| context.user\_agent      | ua                     |
| context.timezone         | timezone               |
| context.campaign.name    | campaign               |
| context.campaign.source  | source                 |
| context.campaign.medium  | medium                 |
| context.campaign.term    | keywords               |
| context.campaign.content | content                |

#### **識別する** <a href="#id-1fob9te" id="id-1fob9te"></a>

[Identify は、](https://segment.com/docs/spec/identify/)Segment **anonymousIdを使用して匿名ユーザーを追跡します**。 ユーザーが電子メール アドレスまたは別の顧客 ID で識別されるとすぐに、Segment はこのデータ セットを匿名のアクティビティと自動的にマージします。 ODP は同じアプローチを使用しており、Segment統合によりこれら 2 つのデータ セットが統合されます。

Segmentには、識別イベント用の次の標準フィールドもあり、ODP はそれらを対応するフィールドにマップします。

| **Segmentフィールド**          | **ODPフィールド** |
| ------------------------- | ------------ |
| traits.firstName          | first\_name  |
| traits.lastName           | last\_name   |
| traits.name               | name         |
| traits.email              | email        |
| traits.address.county     | country      |
| traits.address.state      | state        |
| traits.address.city       | city         |
| traits.address.postalCode | zip          |
| traits.address.street     | street1      |
| traits.avatar             | image\_url   |
| traits.phone              | phone        |
| traits.gender             | gender       |

ODP は、Segmentの識別イベントで見つかった他のフィールドをカスタム フィールドとして適用します。

#### **追跡** <a href="#id-3znysh7" id="id-3znysh7"></a>

[Segment トラック イベントとプロパティ](https://segment.com/docs/spec/track/)を処理できます。 さらに、ODP は次の特別なセマンティック イベントを実装しています。その構造はSegmentのサイトで確認できます。

* [Eメール](https://segment.com/docs/spec/email/#events)
* [E コマース V1](https://segment.com/docs/spec/ecommerce/)
* [E コマース V2](https://segment.com/docs/spec/ecommerce/v2/)

これらのセマンティック イベントは、標準の ODP イベントにある特定の ODP **event\_typeとアクションのペアに対応します。** 以下は、各Segmentのセマンティック イベントから ODP のイベント タイプとアクションまでを詳細に示した表です。

| **Segmentイベント**                                                                                                                    | **ODP イベントの種類** | **ODP アクション**                             |
| ---------------------------------------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------- |
| [Products Searched](https://segment.com/docs/spec/ecommerce/v2/#products-searched)                                                 | navigation      | search                                    |
| [Product List Viewed](https://segment.com/docs/spec/ecommerce/v2/#product-list-viewed)                                             | navigation      | list                                      |
| [Product List Filtered](https://segment.com/docs/spec/ecommerce/v2/#product-list-filtered)                                         | navigation      | filter                                    |
| [Promotion Viewed](https://segment.com/docs/spec/ecommerce/v2/#promotion-viewed)                                                   | promotion       | view                                      |
| [Promotion Clicked](https://segment.com/docs/spec/ecommerce/v2/#promotion-clicked)                                                 | promotion       | click                                     |
| [Product Clicked](https://segment.com/docs/spec/ecommerce/v2/#product-clicked)                                                     | product         | click                                     |
| [Product Viewed](https://segment.com/docs/spec/ecommerce/v2/#product-viewed)                                                       | product         | detail                                    |
| [Product Added / Removed](https://segment.com/docs/spec/ecommerce/v2/#product-added)                                               | product         | add\_to\_cart/ remove\_from\_cart         |
| [Cart Viewed](https://segment.com/docs/spec/ecommerce/v2/#cart-viewed)                                                             | cart            | view                                      |
| [Checkout Started](https://segment.com/docs/spec/ecommerce/v2/#checkout-started)                                                   | checkout        | start                                     |
| [Checkout Step Viewed](https://segment.com/docs/spec/ecommerce/v2/#checkout-step-viewed)                                           | checkout        | step\_view                                |
| [Checkout Step Completed](https://segment.com/docs/spec/ecommerce/v2/#checkout-step-completed)                                     | checkout        | step\_complete                            |
| [Payment Info Entered](https://segment.com/docs/spec/ecommerce/v2/#payment-info-entered)                                           | checkout        | payment\_info\_enter                      |
| [Order Completed](https://segment.com/docs/spec/ecommerce/v2/#order-completed)                                                     | order           | purchase                                  |
| [Order Updated](https://segment.com/docs/spec/ecommerce/v2/#order-updated)                                                         | order           | purchase                                  |
| [Order Refunded](https://segment.com/docs/spec/ecommerce/v2/#order-refunded)                                                       | order           | refund                                    |
| [Order Cancelled](https://segment.com/docs/spec/ecommerce/v2/#order-cancelled)                                                     | order           | cancel                                    |
| [Coupon Entered](https://segment.com/docs/spec/ecommerce/v2/#coupon-entered)                                                       | checkout        | coupon\_enter                             |
| [Coupon Applied](https://segment.com/docs/spec/ecommerce/v2/#coupon-applied)                                                       | checkout        | coupon\_apply                             |
| [Coupon Denied](https://segment.com/docs/spec/ecommerce/v2/#coupon-denied)                                                         | checkout        | coupon\_deny                              |
| [Coupon Removed](https://segment.com/docs/spec/ecommerce/v2/#coupon-removed)                                                       | checkout        | coupon\_remove                            |
| [Product Added to Wishlist / Product Removed from Wishlist](https://segment.com/docs/spec/ecommerce/v2/#product-added-to-wishlist) | product         | add\_to\_wishlist/ remove\_from\_wishlist |
| [Product Shared](https://segment.com/docs/spec/ecommerce/v2/#product-shared)                                                       | product         | share                                     |
| [Cart Shared](https://segment.com/docs/spec/ecommerce/v2/#cart-shared)                                                             | cart            | share                                     |
| [Product Reviewed](https://segment.com/docs/spec/ecommerce/v2/#product-reviewed)                                                   | product         | review                                    |
| [Email Bounced](https://segment.com/docs/spec/email/#email-bounced)                                                                | email           | soft\_bounce                              |
| [Email Opened](https://segment.com/docs/spec/email/#email-opened)                                                                  | email           | open                                      |
| [Email Link Clicked](https://segment.com/docs/spec/email/#email-link-clicked)                                                      | email           | click                                     |
| [Email Marked as Spam](https://segment.com/docs/spec/email/#email-marked-as-spam)                                                  | email           | spamreport                                |
| [Unsubscribed](https://segment.com/docs/spec/email/#unsubscribed)                                                                  | email           | unsubscribe                               |
| [Viewed Product Category](https://segment.com/docs/spec/ecommerce/#viewed-product-category)                                        | navigation      | category                                  |
| [Viewed Product](https://segment.com/docs/spec/ecommerce/#viewed-product)                                                          | product         | detail                                    |
| [Added / Removed Product](https://segment.com/docs/spec/ecommerce/#added-removed-product)                                          | product         | add\_to\_cart/ remove\_from\_cart         |
| [Completed Order](https://segment.com/docs/spec/ecommerce/#completing-an-order)                                                    | order           | purchase                                  |

#### **リストにないイベントを追跡する** <a href="#id-2et92p0" id="id-2et92p0"></a>

Segment イベントが提供されたセマンティクスのいずれにも適合しない場合、ODP はイベントを次のようにマップします。

* イベントタイプ：「トラック」
* アクション: 「あなたのイベント」

ODP イベント タイプの**順序に対応するSegment イベントに**は、ODP フィールドに対応する特別なプロパティがあります。

| **Segmentフィールド**     | **ODPフィールド**          |
| -------------------- | --------------------- |
| properties.order\_id | order.order\_id       |
| properties.total     | order.order\_total    |
| properties.revenue   | order.order\_subtotal |
| properties.discount  | order.order\_discount |
| properties.tax       | order.order\_tax      |
| properties.coupon    | order.coupon\_code    |

注文イベントのプロパティには、各製品のフィールドがリストされる場合もあります。 以下は、注文のSegment製品プロパティと対応する ODP フィールドのリストです。

| **Segmentフィールド**                  | **ODPフィールド**                   |
| --------------------------------- | ------------------------------ |
| properties.products.$.id          | order.items.$.product\_id      |
| properties.products.$.product\_id | order.items.$.product\_id      |
| properties.products.$.sku         | order.items.$.sku              |
| properties.products.$.price       | order.items.$.item\_price      |
| properties.products.$.quantity    | order.items.$.item\_quantity   |
| N/A                               | order.items.$.item\_subtotal\* |

#### **注文品目小計** <a href="#tyjcwt" id="tyjcwt"></a>

Segmentには、特定の注文の品目ごとに小計を表示するフィールドがありません。 ODP は、このフィールドを**order\_item.price \* order\_item.quantity**として計算します。

### ページ/画面 <a href="#id-3dy6vkm" id="id-3dy6vkm"></a>

[Segment ページ イベントは、 ](https://segment.com/docs/spec/page/)ODP では**ページビュー イベント タイプとして表示されます**。 以下は、ページ イベントの標準Segment フィールドと対応する ODP フィールドのリストです。

| **Segmentフィールド**    | **ODPフィールド** |
| ------------------- | ------------ |
| properties.path     | page         |
| properties.name     | name         |
| properties.referrer | referrer     |
| properties.search   | search\_term |
| properties.title    | title        |

#### **Eメール** <a href="#id-1t3h5sf" id="id-1t3h5sf"></a>

すべてのSegment イベントの標準フィールドは、電子メール イベントの ODP フィールドにマップされます。

すでに電子メール サービス プロバイダー (ESP) を直接統合している場合は、電子メールのセマンティック イベントは ESP から直接キャプチャされるため、送信する必要はありません。

#### **カスタムフィールドのサポート** <a href="#id-4d34og8" id="id-4d34og8"></a>

ODP はSegment イベントのカスタム フィールドをサポートします。 カスタム フィールドは、特定のSegment イベントの特性オブジェクトまたはプロパティ オブジェクトに配置する必要があります。

例: Segment.io イベント (プロパティ オブジェクトの「myCustomField」キーに注意してください)

{

"anonymousId": "23adfd82-aa0f-45a7-a756-24f2a7a4c895",

"context": {

"library": {

"name": "analytics.js",

"version": "2.11.1"

},

"page": {

"path": "/academy/",

"referrer": "",

"search": "",

"title": "Analytics Academy",

"url": "<https://segment.com/academy/>"

},

"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_11\_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36",

"ip": "108.0.78.21"

},

"event": "Course Clicked",

"integrations": {},

"messageId": "ajs-f8ca1e4de5024d9430b3928bd8ac6b96",

"properties": {

"title": "Intro to Analytics",

"myCustomField": "my\_custom\_field\_value"

},

"receivedAt": "2015-12-12T19:11:01.266Z",

"sentAt": "2015-12-12T19:11:01.169Z",

"timestamp": "2015-12-12T19:11:01.249Z",

"type": "track",

"userId": "AiUGstSDIg",

"originalTimestamp": "2015-12-12T19:11:01.152Z"

}


---

# 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://manual.dxable.com/optimizely/platform/optimizely-data-platform/optimizely-data-platform-integrations/integrate-segment-legacy.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.
