日本語版はAIによる翻訳です。正確な情報については英語版をご参照ください。 英語版を表示
メインコンテンツまでスキップ

ユーザーイベントデータ

備考

Auxia の標準的な導入プロセスでは、データ統合に伴う複雑な作業はすべて Auxia が対応します。お客様のチームは関連するテーブルを共有するだけで、Auxia の社内デプロイメントチームがデータを Auxia のシステムに取り込むために必要な変換処理をすべて行います。

背景

イベントデータとは、アクションや発生した出来事の記録であり、アクションの種類、発生時刻、関連するユーザーやシステム、その他の関連メタデータなどの詳細とともに個別のイベントとしてキャプチャされます。これらのイベントは、ウェブやモバイルアプリケーション上での訪問者のインタラクションなど、さまざまなソースから取得されます。

ウェブサイトやモバイルアプリでイベントが発生するたびに、通常はアナリティクスデータベースまたはデータウェアハウスにエントリとして保存されます。このエントリはイベントの詳細をすべてキャプチャする1行に対応し、クリックストリームデータの完全なセットを構成します。

以下は、そのテーブルの例です。

userIdTimestampEventEmailChannel
7f8a3c9d-2e4b-48ab2024-09-01T10:23:45Zpage_viewedjohn.doe@auxia.comWebsite
9c4d21f7-1f2a-4a19-9b232024-09-01T11:45:32Zadded_to_cartjane.smith@auxia.comMobile App
c7b43d2e-a1c5-4e6d-bd412024-09-01T12:15:20Zpurchasedtommy.bahama@auxia.comWebsite

Auxia でのイベントデータの活用方法

イベントデータは、Auxia のモデルがユーザー行動のパターンを理解し、結果を予測し、パーソナライゼーション施策を推進するために変換できる豊富な情報源を提供します。イベントが Auxia に接続されると、以下の目的に関連する集計が作成されます。

クライアント側で生成されたイベントは Auxia のシステムに取り込まれ、その上で集計(例: 週あたりのログイン数、先月閲覧した商品数など)が作成され、以下の用途に使用されます。

  1. 適格性条件: どのユーザーがトリートメントを受けるべきか、受けるべきでないかを判定するルールを定義します。

  2. コンテンツのパーソナライゼーション: 特定の属性をメッセージングに動的に挿入して、トリートメントのコンテンツをカスタマイズします。

  3. トリートメント選択の強化: ユーザー属性を活用して、モデルがユーザーに最適なトリートメントを選択できるようにガイドします。

  4. 機械学習の特徴量: 特徴量とは、モデルが予測を行うために使用するデータの測定可能な特性のことです。モデルがデータのパターンを理解し学習するための入力変数と考えてください。

イベントの構造化方法

Auxia に接続するイベントデータは以下の構造を持ちます。

[required] user_id: 各ユーザーの一意な識別子

[required] event_name: イベントの名前(例: add_to_cart、image_upload、sign_up、order_completed など)

[required] event_timestamp: イベントが発生したタイムスタンプ

[optional] event_properties: イベントにコンテキストを追加するキーバリューペアのリスト(例: cart_amount、category_of_purchase など)

[optional] user_properties: ユーザーの状態にコンテキストを追加するキーバリューペアのリスト(例: subscription_status など)

イベントデータが Auxia と共有された後、以下に示す統一イベントスキーマに変換されます。

Proto 構造

message LogEventsRequest {
// For any given Auxia customer, this should always be the same.
// Required.
string project_id = 1;

// Unique ID for the user that can be joined to events and attributes.
// For example, Firebase or Amplitude events should have this ID in each event.
// Required.
string user_id = 2;

// Events for the user.
// Required.
repeated Event events = 3;
}

// Attributes of a single event.
message Event {
// A unique identifier for the event.
// Required.
string event_name = 1;

// A unique identifier for the event. Auxia uses this identifier to de-duplicate the events for the same user.
// Optional.
string insert_id = 2;

// A dictionary of key value pairs that represent data associated with the event.
// Optional.
map<string, PropertyValue> event_properties = 3;

// A dictionary of key value pairs that represent data associated with the user.
// Optional.
map<string, PropertyValue> user_properties = 4;

// The timestamp of the event.
// Required.
.google.protobuf.Timestamp client_event_timestamp = 5;

// The timestamp at which the event was received by the server.
// Optional.
.google.protobuf.Timestamp server_received_timestamp = 6;

// Unique identifier for the user when the user was signed out.
// This identifier is used to identify a user across signed out and signed in sessions.
// Required to support merging user across signed out and signed in sessions.
// Optional.
string pre_login_temp_user_id = 7;

// Unique identifier for a single user session.
// Optional.
string session_id = 8;

// Country of the user.
// Optional.
string country = 9;

// Region of the user.
// Optional.
string region = 10;

// City of the user.
// Optional.
string city = 11;

// IP Address of the user.
// Optional.
string ip_address = 12;

// Unique identifier for the user's device.
// Optional.
string device_id = 13;

// Version of the app that the events correspond to.
// Optional.
string app_version_id = 14;
}

// Value corresponding to the property.
// Required.
message PropertyValue {
oneof property_value {
int64 long_value = 1;
double double_value = 2;
string string_value = 3;
bool boolean_value = 4;
.google.protobuf.Timestamp timestamp_value = 5;
}
}

スキーマ

[
{
"name": "project_id",
"mode": "REQUIRED",
"type": "STRING",
"description": "Unique identifier for a given Auxia customer.",
"fields": []
},
{
"name": "user_id",
"mode": "REQUIRED",
"type": "STRING",
"description": "Unique ID for the user.",
"fields": []
},
{
"name": "event_name",
"mode": "REQUIRED",
"type": "STRING",
"description": "A unique identifier for the event.",
"fields": []
},
{
"name": "insert_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "A unique identifier for de-duplicating events.",
"fields": []
},
{
"name": "event_properties",
"mode": "REPEATED",
"type": "RECORD",
"description": "A dictionary of key value pairs that represent data associated with the event. Note that only one of the value columns should be set for a single property.",
"fields": [
{
"name": "property_name",
"mode": "REQUIRED",
"type": "STRING",
"description": "Identifier for the property.",
"fields": []
},
{
"name": "long_value",
"mode": "NULLABLE",
"type": "INTEGER",
"description": "Long value corresponding to the property.",
"fields": []
},
{
"name": "double_value",
"mode": "NULLABLE",
"type": "FLOAT",
"description": "Double value corresponding to the property.",
"fields": []
},
{
"name": "string_value",
"mode": "NULLABLE",
"type": "STRING",
"description": "String value corresponding to the property.",
"fields": []
},
{
"name": "boolean_value",
"mode": "NULLABLE",
"type": "BOOLEAN",
"description": "Boolean value corresponding to the property.",
"fields": []
},
{
"name": "timestamp_value",
"mode": "NULLABLE",
"type": "TIMESTAMP",
"description": "Timestamp value corresponding to the property.",
"fields": []
}
]
},
{
"name": "user_properties",
"mode": "REPEATED",
"type": "RECORD",
"description": "A dictionary of key value pairs that represent data associated with the user. Note that only one of the value columns should be set for a single property.",
"fields": [
{
"name": "property_name",
"mode": "REQUIRED",
"type": "STRING",
"description": "Identifier for the property.",
"fields": []
},
{
"name": "long_value",
"mode": "NULLABLE",
"type": "INTEGER",
"description": "Long value corresponding to the property.",
"fields": []
},
{
"name": "double_value",
"mode": "NULLABLE",
"type": "FLOAT",
"description": "Double value corresponding to the property.",
"fields": []
},
{
"name": "string_value",
"mode": "NULLABLE",
"type": "STRING",
"description": "String value corresponding to the property.",
"fields": []
},
{
"name": "boolean_value",
"mode": "NULLABLE",
"type": "BOOLEAN",
"description": "Boolean value corresponding to the property.",
"fields": []
},
{
"name": "timestamp_value",
"mode": "NULLABLE",
"type": "TIMESTAMP",
"description": "Timestamp value corresponding to the property.",
"fields": []
}
]
},
{
"name": "client_event_timestamp",
"mode": "REQUIRED",
"type": "TIMESTAMP",
"description": "The timestamp of the event.",
"fields": []
},
{
"name": "server_received_timestamp",
"mode": "NULLABLE",
"type": "TIMESTAMP",
"description": "The timestamp at which the event was received by the server.",
"fields": []
},
{
"name": "pre_login_temp_user_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Unique identifier for the user across sessions.",
"fields": []
},
{
"name": "session_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Unique identifier for a single user session.",
"fields": []
},
{
"name": "country",
"mode": "NULLABLE",
"type": "STRING",
"description": "Country of the user.",
"fields": []
},
{
"name": "region",
"mode": "NULLABLE",
"type": "STRING",
"description": "Region of the user.",
"fields": []
},
{
"name": "city",
"mode": "NULLABLE",
"type": "STRING",
"description": "City of the user.",
"fields": []
},
{
"name": "ip_address",
"mode": "NULLABLE",
"type": "STRING",
"description": "IP Address of the user.",
"fields": []
},
{
"name": "device_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Unique identifier for the user's device.",
"fields": []
},
{
"name": "app_version_id",
"mode": "NULLABLE",
"type": "STRING",
"description": "Version of the app that the events correspond to.",
"fields": []
}
]

SQL でのプロパティ構造の作成

CREATE OR REPLACE FUNCTION `<gcp-project-name>.<data-set>.create_properties`(property_name STRING, data_type STRING, column_value STRING)
RETURNS STRUCT<
property_name STRING,
long_value INT64,
double_value FLOAT64,
string_value STRING,
boolean_value BOOL,
timestamp_value TIMESTAMP
>
AS (
CASE
WHEN data_type = 'LONG' THEN STRUCT(
property_name AS property_name,
CAST(column_value AS INT64) AS long_value,
CAST(NULL AS FLOAT64) AS double_value,
NULL AS string_value,
CAST(NULL AS BOOL) AS boolean_value,
CAST(NULL AS TIMESTAMP) AS timestamp_value
)
WHEN data_type = 'DOUBLE' THEN STRUCT(
property_name AS property_name,
NULL AS long_value,
CAST(column_value AS FLOAT64) AS double_value,
NULL AS string_value,
CAST(NULL AS BOOL) AS boolean_value,
CAST(NULL AS TIMESTAMP) AS timestamp_value
)
WHEN data_type = 'STRING' THEN STRUCT(
property_name AS property_name,
NULL AS long_value,
CAST(NULL AS FLOAT64) AS double_value,
column_value AS string_value,
CAST(NULL AS BOOL) AS boolean_value,
CAST(NULL AS TIMESTAMP) AS timestamp_value
)
WHEN data_type = 'BOOLEAN' THEN STRUCT(
property_name AS property_name,
NULL AS long_value,
CAST(NULL AS FLOAT64) AS double_value,
NULL AS string_value,
CAST(column_value AS BOOL) AS boolean_value,
CAST(NULL AS TIMESTAMP) AS timestamp_value
)
WHEN data_type = 'TIMESTAMP' THEN STRUCT(
property_name AS property_name,
NULL AS long_value,
CAST(NULL AS FLOAT64) AS double_value,
NULL AS string_value,
CAST(NULL AS BOOL) AS boolean_value,
CAST(column_value AS TIMESTAMP) AS timestamp_value
)
-- Treat like STRING.
ELSE STRUCT(
property_name AS property_name,
NULL AS long_value,
CAST(NULL AS FLOAT64) AS double_value,
column_value AS string_value,
CAST(NULL AS BOOL) AS boolean_value,
CAST(NULL AS TIMESTAMP) AS timestamp_value
)
END
);