尺寸:viewer

在本主題中,您將了解Analytics APIviewer尺寸。viewer維度可依檢視者提供分析。

簡介

viewer維度可讓您依檢視者查看分析。如果觀看者 ID 沒有從播放器發送到分析數據收集器,我們將嘗試從觀看者的 IP 地址和用戶代理構建一個觀看者 ID - 但是這種方法很容易出錯。如果您已登錄查看器並因此可以可靠地識別它們,則查看器分析最有用。

網址參數

分析 API 報表支援下列 URL 參數。

網址參數
參數 描述 必填 預設
account 您要報告的帳戶 一個或多個帳戶ID作為逗號分隔的列表
dimensions 要報告的維度 一個或多個維度作為逗號分隔列表(某些組合無效 - 使用 此處的交互式工具 確定組合是否有效)
where 用於指定報告的過濾器 {dimension}=={value} - 一個或多個以分號分隔的列表。該值將是該維度主要指標的一個或多個值。例如:video==video_idcountry=country-code、或viewer=viewer_id(在最後一種情況下,viewer_id 的形式將根據您是自己捕獲和發送某種 viewer_id,還是根據分析系統生成的值而有所不同)。
limit 退貨數量 正整數 +10
offset 要跳過的項目數 正整數 0
sort 用於排序項目的字段 請求返回的任何字段 video_view
fields 要返回的字段 根據您要報告的維度而變化 視頻,video_view
format 格式化以返回結果 json(默認)|格式 | xlxs json
reconciled 如果包含,會將結果限制為歷史數據或實時數據。分析資料來自多個來源:有些是由播放程式傳送,但其他資料則是從 CDN 和 Video Cloud 系統收集。為了盡快提供分析,我們會在可用時立即開始提供「即時」資料,然後在收集和處理所有來源的資料後稍後調整分析。完全處理後的數據稱為已協調 真實|假 真正
from 請求的日期範圍的開始 下列其中一項:
  • ISO 8601 日期 (YYYY-MM-DD)
  • 以毫秒為單位的紀元時間(例如:1659641316719 [= 2022 年 8 月 4 日星期四 7:28:36.719 PM GMT])。請參閱 大紀元時間轉換器。
  • 一個字符串:from=alltime
  • +/-以天(d),週(w)或月(m)為單位的相對日期-例如:from=-6m&to=%2B2w(從 6 個月前到 2 週之後的時間段-請注意,+ 符號需要被 URI 編碼為%2B

參與端點或如果 reconciled=false,則只允許過去 32 天內的日期。

-30d
to 請求的日期範圍的結尾 下列其中一項:
  • ISO 8601 日期 (YYYY-MM-DD)
  • 以毫秒為單位的紀元時間(例如:1659641316719 [= 2022 年 8 月 4 日星期四 7:28:36.719 PM GMT])。請參閱 大紀元時間轉換器。
  • 一個字符串:to=now
  • +/-以天(d),週(w)或月(m)為單位的相對日期-例如:from=-6m&to=%2B2w(從 6 個月前到 2 週之後的時間段-請注意,+ 符號需要被 URI 編碼為%2B

參與端點或如果 reconciled=false,則只允許過去 32 天內的日期。

現在

可用字段

可以為維度返回以下字段。

  • application -虛擬事件體驗 ID。如果沒有通過,將為空
  • engagement_score - 參與得分
  • video_engagement_1 -視頻參與度為持續時間的 1%
  • video_engagement_25 -視頻參與度為持續時間的 25%
  • video_engagement_50 -視頻參與度為持續時間的 50%
  • video_engagement_75 -視頻參與度為持續時間的 75%
  • video_engagement_100 -視頻參與度在持續時間的 100%
  • time -收到的最後一個事件的紀元時間
  • video_view -觀看器播放開始的次數
  • viewer[1] -事件查看器(SSO ID 或設備 ID 或基於用戶代理和 IP 的唯一字符串)

如果查詢還包括相關維度,則可以使用其他字段:

  • city -觀眾所在的城市(需要city維度)
  • country -檢視器所在的國家 (代碼) (需要country維度)
  • country_name -檢視者所在的國家/地區名稱 (需要country維度)
  • region -查看器所在的區域(代碼)(需要region維度)
  • region_name -檢視器所在的地區名稱 (需要region維度)
  • rebuffering_seconds -玩家花費減緩的總時間(要求countryregion被包括在內)
  • device_type -檢視器使用的裝置類型 (需要device_type維度)

發送查看者 ID

要將觀眾 ID 發送到分析系統,您必須創建邏輯來構造一個唯一 ID,該 ID 將在運行時識別觀眾,然後將其從播放器發送到分析數據收集器。構建 ID 的邏輯將取決於查看者如何驗證以查看您的內容。Brightcove 網絡播放器以及 iOS 和 Android SDK 播放器都可以將用戶 ID 發送到分析。以下部分將向您展示如何為網絡和 SDK 播放器執行此操作。

發送觀眾 ID - Brightcove 播放器

首先,您需要設置用戶標識符來存儲他們的觀看活動。

布萊特灣玩家

如果您使用的是Brightcove Player,請按照下列步驟操作:

  1. 即使瀏覽者資料會自動傳送至 Brightcove 分析,您仍需要設定使用者識別碼。為此,請使用setUser()方法。例如:

    myPlayer.bcAnalytics.client.setUser('viewer id');

    在託管 Brightcove Player 的網站上,您可以使用身份驗證網關或某些身份管理解決方案來跟踪查看者。使用此查看器 ID 作為查看器標識符以傳遞給 Brightcove 分析。

  2. 在播放器上設置任何源之前設置查看器 ID 很重要。初始化播放器後應立即調用它。

    <video-js
      id="myPlayerID"
      data-account="1752604059001"
      data-player="hyQW6GByl"
      data-embed="default"
      controls=""
      data-video-id="6156696074001"
      data-playlist-id=""
      data-application-id=""
      width="640" height="360"></video-js>
    <script src="https://players.brightcove.net/1752604059001/hyQW6GByl_default/index.min.js"></script>
    
    <script>
      videojs.getPlayer('myPlayerID').ready(function() {
        var myPlayer = this;
    
        // Set the viewer id for Brightcove analytics
        myPlayer.bcAnalytics.client.setUser('viewer id');
      });
    </script>
  3. 當。。。的時候setUser()使用方法時,不會對該值進行哈希處理,並將與所有後續信標一起以明文形式發送。

    請注意player_init事件將不包括user在這種情況下,但所有video_*事件應該包括它。

自定義網絡播放器

如果您要建置不使用 Brightcove 播放器的自訂實作,請將user參數新增至您的資料收集 API 請求。有關詳細信息,請參見概述:數據收集API v2文件。

在託管播放器的網站上,您可以使用身份驗證網關或某些身份管理解決方案來跟踪觀眾。使用此查看器 ID 作為查看器標識符以傳遞給 Brightcove 分析。

對於 Brightcove Native SDK 播放器,您還需要發送一個查看器 ID,除非您依賴於 Brightcove 生成的播放器。

Android

對於 Android 播放器,添加此代碼:

HashMap<String, String> baseParams = new HashMap<>();
  baseParams.put(Analytics.Fields.USER, "viewer id");
  baseParams.put(Analytics.Fields.APPLICATION_ID, "application id");
  
  HashMap<String, Object> eventParams = new HashMap<>();
  eventParams.put(Analytics.Fields.BASE_PARAMS, baseParams);
  eventEmitter.emit(EventType.ADD_ANALYTICS_BASE_PARAMS, eventParams);
  

iOS

對於 iOS 或 tvOS,添加以下代碼:

@try
  {
    [BCOVGlobalConfiguration.sharedConfig setValue:@{
      @"privateUser": self.viewer id,
      @"privateApplication": @"application id"
    }
    forKey:@"privateSessionAnalytics"];
  }
  @catch (NSException *e)
  {
    NSLog(@"%@", e.description);
  }

篩選值

用作過濾器時,尺寸可以縮小結果範圍。

過濾值:觀眾 ID

組合尺寸

viewer維度可以與其他數個維度結合使用,這些維度會新增可擷取的其他欄位。詳情如下表所示。(如果包含維度,則默認情況下響應中包含粗體 項。)

支持的尺寸組合
尺寸標註 附加字段
video video
video_engagement_1
video_engagement_25
video_engagement_50
video_engagement_75
video_engagement_100
video_percent_viewed
video_seconds_viewed
video_view
video.tags
video.reference_id
video.name
video.description
video.long_description
video.duration
country country
country_name
region region
region_name
city city
dma
device_type device_type

索取範例

尺寸要求樣品

    https://analytics.api.brightcove.com/v1/data?accounts=3365624256001&尺寸=觀眾&限制=10&字段=查看器、時間、video_view、engagement_score
示例響應
{
  "item_count": 8,
  "items": [
    {
      "engagement_score": null,
      "viewer": "6798840584846290049",
      "time": 1623870475157,
      "video_view": 0
    },
    {
      "engagement_score": 100,
      "viewer": "-1094565064376617663",
      "time": 1623870472882,
      "video_view": 1
    },
    {
      "engagement_score": 100,
      "viewer": "8997125557862445199",
      "time": 1623870433989,
      "video_view": 1
    },
    {
      "engagement_score": 39.13,
      "viewer": "-8839675754655082792",
      "time": 1623872904633,
      "video_view": 1
    },
    {
      "engagement_score": 143.48,
      "viewer": "-6771654281667224776",
      "time": 1623869869930,
      "video_view": 2
    }
  ],
  "summary": {
    "engagement_score": 110.51,
    "time": 1623875119506,
    "video_view": 12
  }
}

多維請求示例

    https://analytics.api.brightcove.com/v1/data?accounts=3365624256001&尺寸=查看器、國家、地區、城市、視頻、設備類型&限制=10& fields=viewer,time,video_view,engagement_score,video_percent_viewed,video_seconds_viewed,video_engagement_1,video_engagement_25,video_engagement_50,video_engagement_75,video_engagement_100,video.tags,video.reference_id,video.name,video.description,video.duration,video.long_description,dma,國家名稱、地區名稱
示例響應
{
  "item_count": 8,
  "items": [
    {
      "country": "MX",
      "viewer": "6798840584846290049",
      "video.name": "Bison",
      "video_seconds_viewed": 23,
      "video_engagement_75": 1,
      "city": "Zapopan",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 1,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 100,
      "country_name": "Mexico",
      "region_name": null,
      "video_engagement_25": 1,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 1,
      "engagement_score": null,
      "video_engagement_1": 1,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "0",
      "time": 1623870475157,
      "video_view": 0,
      "region": "MX-JAL"
    },
    {
      "country": "US",
      "viewer": "-8839675754655082792",
      "video.name": "Bison",
      "video_seconds_viewed": 9,
      "video_engagement_75": 0,
      "city": "Safety Harbor",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 0,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 39.13,
      "country_name": "United States",
      "region_name": "Florida",
      "video_engagement_25": 1,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 0,
      "engagement_score": 39.13,
      "video_engagement_1": 1,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "539",
      "time": 1623872904633,
      "video_view": 1,
      "region": "US-FL"
    },
    {
      "country": "US",
      "viewer": "-1094565064376617663",
      "video.name": "Bison",
      "video_seconds_viewed": 23,
      "video_engagement_75": 1,
      "city": "Boulder",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 1,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 100,
      "country_name": "United States",
      "region_name": "Colorado",
      "video_engagement_25": 1,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 1,
      "engagement_score": 100,
      "video_engagement_1": 1,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "751",
      "time": 1623870472882,
      "video_view": 1,
      "region": "US-CO"
    },
    {
      "country": "US",
      "viewer": "8997125557862445199",
      "video.name": "Bison",
      "video_seconds_viewed": 23,
      "video_engagement_75": 1,
      "city": "Boulder",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 1,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 100,
      "country_name": "United States",
      "region_name": "Colorado",
      "video_engagement_25": 1,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 1,
      "engagement_score": 100,
      "video_engagement_1": 1,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "751",
      "time": 1623870433989,
      "video_view": 1,
      "region": "US-CO"
    },
    {
      "country": "US",
      "viewer": "-4530870087560842176",
      "video.name": "Bison",
      "video_seconds_viewed": 46,
      "video_engagement_75": 2,
      "city": "Newton Center",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 2,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 200,
      "country_name": "United States",
      "region_name": "Massachusetts",
      "video_engagement_25": 2,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 2,
      "engagement_score": 100,
      "video_engagement_1": 2,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "506",
      "time": 1623875061754,
      "video_view": 2,
      "region": "US-MA"
    },
    {
      "country": "MX",
      "viewer": "-6771654281667224776",
      "video.name": "Bison",
      "video_seconds_viewed": 66,
      "video_engagement_75": 1,
      "city": "Zapopan",
      "device_type": "desktop",
      "video": "5754204614001",
      "video_engagement_50": 1,
      "video.description": "Bison in Yellowstone National Park",
      "video.reference_id": null,
      "video_percent_viewed": 286.96,
      "country_name": "Mexico",
      "region_name": null,
      "video_engagement_25": 1,
      "video.long_description": "Bison in Yellowstone National Park. This is the long description.  This was filmed in Yellowstone National Park.",
      "video.duration": 23295,
      "video_engagement_100": 1,
      "engagement_score": 143.48,
      "video_engagement_1": 1,
      "video.tags": [
        "animals",
        "simulive",
        "yellowstone"
      ],
      "dma": "0",
      "time": 1623869869930,
      "video_view": 2,
      "region": "MX-JAL"
    }
  ],
  "summary": {
    "video_seconds_viewed": 305,
    "video_engagement_75": 10,
    "video_engagement_25": 11,
    "video_engagement_50": 10,
    "video_engagement_100": 10,
    "engagement_score": 110.51,
    "video_engagement_1": 11,
    "video_percent_viewed": 1326.09,
    "country_name": null,
    "region_name": null,
    "time": 1623875119506,
    "video_view": 12,
    "account": "3365624256001"
  }
}