サブスクリプションイベントログは、新しいパートナーデータ製品であるSlate Analyticsの一部です。サブスクリプションイベントログは、以下のいくつかの点で他のSlateレポートとは異なります。
- 追加のみです(各ファイルに新しいデータがあります)
- UIでダウンロードすることはできません (API経由でのみアクセスできます)
- パートナーのデータエンジニア向けに明確に構築されており、詳細なデータを使用して分析を実行できます
このトピックでは、データエンジニアがサブスクリプションイベントログデータを取得するためのパイプラインを設定し、サブスクリプションイベントログファイルの値を定義し、サンプルクエリと、パートナーがこのデータを最適に使用するための提案を提供します。
開始するには、APIオンボーディングガイドのガイドラインを確認してください。Slateから取得できるレポートの詳細については、レポートAPIドキュメントを参照してください。
サブスクリプションイベントログデータの取り込み
このデータにアクセスするには、以下が必要です。
- Amazonセキュリティプロファイルを使用したログイン
- トークンを要求するための認証コード
- すべてのCurlリクエスト用のトークン
Prime Videoは、毎日午後11時59分(UTC)に新しいサブスクリプションイベントログファイルを公開します。 これらのログには、最大12時間前のデータが含まれる場合があります。 遅延が発生した場合は、できるだけ早くEメールでご連絡いたします。
サブスクリプションイベントログのリストは、次のCurl URLにあります。
https://videocentral.amazon.com/apis/v1/accounts/{account_id}/channelsAnalyticsLogs/{channel/studio_id}/reportTypes/amzn1.vcpa.arcs.insight.29fb1b79-9aa1-4732-9ebb-4befccbeb09a/reports
以下のリクエストパラメータを使用します。{
limit: {The number of reports returned in a single request (the page size).},
offset: {The number of pages to skip (the page number).},
modifiedDateGte: {UTC timezone since you last pull}
}
以下のコードは、このリクエストに対する応答の例を示しています。
{
"next":{link to next request},
"total":{num of reports},
"data":
[
{
"downloadUrl":"{presigned url}",
"numRows":{num of rows},
"reportDateBegin":"2024-07-18",
"reportDateEnd":"2024-07-19",
"modifiedDate":"2024-07-23T17:24:29.312Z",
"name":"Channels Persistent CID Subscription Event Log",
"cadence":"Daily"}
]
}
ダウンロードURLを使用してCSVファイルをダウンロードします。
これらのリンクを使用して、account_idまたはchannel/studio_idを見つけてください。
新規データと変更データの管理
変更ログの形式で消費者にデータを提供します。各サブスクリプションイベントは1回のみ公開されます。ただし、以前に提供された行の列値を更新する必要がある場合は、次の利用可能なファイルに変更を反映するために、レコードの新しいバージョンを公開します。すべてのデータ変更が確実に確保されるように、変更ログは追加のみとなります。データエンジニアは、この変更ログを使用してサブスクリプションデータテーブルを直接更新できます。
変更ログを処理するときは、last_update_time_utc列に基づいて、特定のsubscription_event_idの最新のレコードを常に使用することが不可欠です。これにより、各レコードの最新バージョンが常に保持されます。レコードを削除する必要がある場合、このアクションはis_deleted列に反映されます。1の値はレコードが削除されたことを示し、0の値はアクティブなレコードを表します。
この変更ログアプローチにより、新規データと変更データを効果的に管理し、サブスクリプションデータテーブルが常に正確で最新の情報に保たれることが保証されます。
列の定義
次の表は、サブスクリプションイベントログに表示される列と値を定義しています。
列 |
定義 |
subscription_event_id |
このログを通じて提供される各サブスクリプションイベントの固有ID。 |
subscription_event_type |
発生したサブスクリプションイベントのタイプ。
|
subscription_event_time_utc |
サブスクリプションイベントが発生した時刻(UTCに標準化)。 |
subscription_event_time_zone |
サブスクリプションマーケットプレイスのタイムゾーン。 |
CID |
匿名化された顧客識別子。この顧客識別子(CID)は、1つの親チャンネルの下にあるすべてのイベントに対して保持され、階層間の移動と顧客ライフサイクルの追跡が可能になります。 |
offer_id |
イベントが発生した特定のサブスクリプションオファーのID。 |
offer_name |
人間が読める形式でのオファーの名前。 |
offer_type |
オファーのタイプ。 |
offer_marketplace |
サブスクリプションオファーが提供されていたマーケットプレイス。 |
offer_billing_type |
オファーに必要な支払いの種類。
|
offer_payment_amount |
offer_idの請求金額。 |
benefit_id |
オファーが設定されているPrime Video特典のID。 |
channel_label |
オファーが提供されているチャンネルの名前。 注:この列にnull値が表示される場合は、Slate Analyticsへのオンボーディングが必要になる場合があります。オファーや階層を1つのチャンネルラベルにまとめるには、担当のCAMまたはPSMにお問い合わせください。 |
channel_tier_label |
オファーが提供されているチャンネルの名前。 注:この列にnull値が表示される場合は、Slate Analyticsへのオンボーディングが必要になる場合があります。オファーを1つの階層にまとめる場合は、担当のCAMまたはPSMにお問い合わせください。 |
is_promo |
イベント時にオファーがプロモーションの対象になっているかどうかを示します(0=プロモーション対象、1=プロモーション非対象)。 |
create_time_utc |
サブスクリプションイベントログレコードが作成された時刻(UTCに標準化)。 |
last_update_time_utc |
サブスクリプションイベントログレコードが最後に更新された時刻(UTCに標準化)。 |
is_deleted |
以前に作成されたレコードを削除するかどうかを示します(0=保持、1=削除)。 |
一般的なユースケース
サブスクリプションイベントログで提供されるデータを使用すると、個々のカスタマージャーニーを詳細にマッピングしたり、リテンションなどの主要な指標のデータを集計したりできます。
以下のセクションでは、このデータセットを活用するための一般的なユースケースとサンプルクエリについて説明します。
注:これらのサンプルクエリはすべてAWS Athenaで動作するように作成されています。この例では、セントラルサブスクリプションイベントログテーブルにはtahoe_cleansed.subs_event_obtという名前が付いています。
測定期間終了時の総登録者数
次のクエリは、2024年6月末のチャンネル登録数を示します。すべてのUTCタイムスタンプはご利用地域のタイムゾーンに変換されます。WITH main AS (
SELECT
a.cid,
a.offer_id,
SPLIT(a.offer_id, '-')[1] as offer_group_id,
cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp) AS curr_subscription_event_time,
a.subscription_event_type AS curr_event_type,
LEAD(a.subscription_event_type) OVER (
PARTITION BY a.encrypted_customer_id, SPLIT(a.offer_id, '-')[1]
ORDER BY cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)
) AS next_event_type,
LEAD(cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)) OVER (
PARTITION BY a.encrypted_customer_id, SPLIT(a.offer_id, '-')[1]
ORDER BY cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)
) AS next_subscription_event_time
FROM
tahoe_cleansed.subs_event_obt a
WHERE
a.subscription_event_type IN ('Start', 'Renewal', 'Cancel')
)
SELECT
offer_id,
COUNT(DISTINCT cid || offer_group_id) AS month_end_subscriptions
FROM
main
WHERE
(curr_event_type IN ('Renewal', 'Start') AND next_event_type IS NULL AND
curr_subscription_event_time < CAST('2024-07-01' as timestamp)) -- Currently active subscriptions
OR (
curr_event_type IN ('Renewal', 'Start')
AND curr_subscription_event_time < CAST('2024-07-01' AS TIMESTAMP)
AND next_event_type = 'Cancel'
AND next_subscription_event_time >= CAST('2024-07-01' AS TIMESTAMP)
) -- 月末までにアクティブになり、月末後にキャンセルされました
OR (
curr_event_type IN ('Renewal', 'Start')
AND next_event_type IN ('Renewal', 'Start')
AND curr_subscription_event_time < CAST('2024-07-01' AS TIMESTAMP)
AND next_subscription_event_time >= CAST('2024-07-01' AS TIMESTAMP)
) -- 月末以降もアクティブのまま更新されたすべてのアクティブを取得します
GROUP BY
offer_id;
測定期間終了時の有料サブスクリプションの合計数
次のクエリは、2024年6月末の有料サブスクリプション数を示します。すべてのUTCタイムスタンプはご利用地域のタイムゾーンに変換されます。WITH main AS (
SELECT
a.cid,
a.offer_id,
SPLIT(a.offer_id, '-')[1] as offer_group_id,
cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp) AS curr_subscription_event_time,
a.subscription_event_type AS curr_event_type,
LEAD(a.subscription_event_type) OVER (
PARTITION BY a.encrypted_customer_id, SPLIT(a.offer_id, '-')[1]
ORDER BY cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)
) AS next_event_type,
LEAD(cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)) OVER (
PARTITION BY a.encrypted_customer_id, SPLIT(a.offer_id, '-')[1]
ORDER BY cast(from_iso8601_timestamp(date_format(at_timezone(a.subscription_event_time_utc, a.subscription_event_time_zone), '%Y-%m-%dT%H:%i:%s')) as timestamp)
) AS next_subscription_event_time
FROM
tahoe_cleansed.subs_event_obt a
WHERE
a.subscription_event_type IN ('Start', 'Renewal', 'Cancel').
and offer_billing_type = 'HO'
)
SELECT
offer_id,
COUNT(DISTINCT cid || offer_group_id) AS month_end_subscriptions
FROM
main
WHERE
(curr_event_type IN ('Renewal', 'Start') AND next_event_type IS NULL AND
curr_subscription_event_time < CAST('2024-07-01' as timestamp)) -- Currently active subscriptions
OR (
curr_event_type IN ('Renewal', 'Start')
AND curr_subscription_event_time < CAST('2024-07-01' AS TIMESTAMP)
AND next_event_type = 'Cancel'
AND next_subscription_event_time >= CAST('2024-07-01' AS TIMESTAMP)
) -- 月末までにアクティブになり、月末後にキャンセルされました
OR (
curr_event_type IN ('Renewal', 'Start')
AND next_event_type IN ('Renewal', 'Start')
AND curr_subscription_event_time < CAST('2024-07-01' AS TIMESTAMP)
AND next_subscription_event_time >= CAST('2024-07-01' AS TIMESTAMP)
) -- 月末以降もアクティブのまま更新されたすべてのアクティブを取得します
GROUP BY
offer_id;
2024年6月の新規登録者
次のクエリは、2024年6月1日から7月1日までの間に登録した登録者の総数を示します。-- New Subscribers
SELECT
offer_id, COUNT(DISTINCT cid) AS new_subscribers
FROM
tahoe_cleansed.subs_event_obt
WHERE
subscription_event_type = 'Start'
AND subscription_event_time_utc >= CAST('2024-06-01' AS TIMESTAMP)
AND subscription_event_time_utc < CAST('2024-07-01' AS TIMESTAMP)
GROUP BY offer_id;
キャンセルされたイベント
次のクエリは、2024年6月1日から7月1日までの間にキャンセルされたサブスクリプションの総数を示します。
SELECT
count(distinct cid || offer_id)
FROM
tahoe_cleansed.subs_event_obt
WHERE subscription_event_type = 'Cancel'
AND subscription_event_time_utc >= CAST('2024-06-01' AS TIMESTAMP)
AND subscription_event_time_utc < CAST('2024-07-01' AS TIMESTAMP)
2024年6月のHOへの無料体験の切り替え
次のクエリは、2024年6月にハードオファーに切り替えた無料体験の顧客の総数を示します。
WITH events AS (
SELECT
subscription_event_id,
cid,
offer_id,
offer_billing_type,
subscription_event_type,
subscription_event_time_utc,
CASE
WHEN subscription_event_type = 'Start' or subscription_event_type = 'Renewal' THEN 1
ELSE 0
END AS is_active,
ROW_NUMBER() OVER (PARTITION BY cid, offer_id ORDER BY subscription_event_time_utc DESC) AS rn
FROM
tahoe_cleansed.subs_event_obt
WHERE
subscription_event_time_utc >= CAST('2024-06-01' AS TIMESTAMP)
AND subscription_event_time_utc < CAST('2024-07-01' AS TIMESTAMP)
),
ft_events AS (
SELECT
cid,
offer_id,
min(subscription_event_time_utc) as ft_event_time
from events
group by cid,
offer_id
),
ho_events AS (
SELECT
cid,
offer_id,
subscription_event_time_utc as ho_event_time
FROM
events
WHERE
rn = 1 and offer_billing_type = 'HO' and is_active = 1
),
conversions as (select a.cid,
a.offer_id,
a.ft_event_time,
b.ho_event_time
from ft_events a
inner join ho_events b on a.cid = b.cid and a.offer_id = b.offer_id
where b.ho_event_time > a.ft_event_time)
select count(distinct cid || offer_id) as num_conversions
from conversions;
Offer_ID1からOffer_ID2への顧客階層の変更
次のクエリは、親チャンネル内でサブスクリプション階層を変更した顧客の総数を示します。
with first_offer as (
select cid,min(subscription_event_time_utc) as first_offer_time
from tahoe_cleansed.subs_event_obt
where subscription_event_type in ('Start','Renewal')
and offer_id = 'offer_id1'
group by cid
),
second_offer as (
select cid,min(subscription_event_time_utc) as second_offer_time
from tahoe_cleansed.subs_event_obt
where subscription_event_type in ('Start','Renewal')
and offer_id = 'offer_id2'
group by cid
)
select distinct a.cid
from first_offer a
inner join second_offer b on a.cid = b.cid
where b.second_offer_time >a.first_offer_time;