メインコンテンツへスキップ
POST
/
media-bridge
/
v1
/
events
/
attention-span
Create an attention span event
curl --request POST \
  --url https://api.hubapi.com/media-bridge/v1/events/attention-span \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "occurredTimestamp": 123,
  "rawDataMap": {},
  "sessionId": "<string>",
  "_hsenc": "<string>",
  "contactId": 123,
  "contactUtk": "<string>",
  "externalId": "<string>",
  "mediaBridgeId": 123,
  "mediaName": "<string>",
  "mediaUrl": "<string>",
  "pageId": 123,
  "pageName": "<string>",
  "pageUrl": "<string>",
  "rawDataString": "<string>"
}
'
{
  "contactId": 123,
  "mediaBridgeId": 123,
  "mediaBridgeObjectCoordinates": "<string>",
  "mediaBridgeObjectTypeId": "<string>",
  "mediaName": "<string>",
  "occurredTimestamp": 123,
  "percentRange": "<string>",
  "portalId": 123,
  "providerId": 123,
  "sessionId": "<string>",
  "totalPercentPlayed": 123,
  "mediaUrl": "<string>",
  "pageId": 123,
  "pageName": "<string>",
  "pageObjectCoordinates": "<string>",
  "pageUrl": "<string>",
  "rawData": "<string>",
  "totalSecondsPlayed": 123
}

Supported products

承認

Authorization
string
header
必須

The access token received from the authorization server in the OAuth 2.0 flow.

ボディ

application/json
mediaType
enum<string>
必須
利用可能なオプション:
AUDIO,
DOCUMENT,
IMAGE,
OTHER,
VIDEO
occurredTimestamp
integer<int64>
必須
rawDataMap
object
必須
sessionId
string
必須
_hsenc
string
contactId
integer<int64>
contactUtk
string
derivedValues
object
externalId
string
externalPlayContext
enum<string>
利用可能なオプション:
EMAIL,
EXTERNAL_PAGE
mediaBridgeId
integer<int64>
mediaName
string
mediaUrl
string
pageId
integer<int64>
pageName
string
pageUrl
string
rawDataString
string

レスポンス

successful operation

contactId
integer<int64>
必須

The ID of the contact in HubSpot’s system that consumed the media. This can be fetched using HubSpot's Get contact by usertoken (utk) API. The API also supports supplying a usertoken, and will handle converting this into a contact ID automatically.

mediaBridgeId
integer<int64>
必須
mediaBridgeObjectCoordinates
string
必須
mediaBridgeObjectTypeId
string
必須
mediaName
string
必須
mediaType
enum<string>
必須
利用可能なオプション:
AUDIO,
DOCUMENT,
IMAGE,
OTHER,
VIDEO
occurredTimestamp
integer<int64>
必須

The timestamp at which this event occurred, in milliseconds since the epoch.

percentRange
string
必須
portalId
integer<int32>
必須

The ID of the HubSpot account.

providerId
integer<int32>
必須
sessionId
string
必須
totalPercentPlayed
number
必須

The percent of the media that the user consumed. Providers may calculate this differently depending on how they consider repeated views of the same portion of media. For this reason, the API will not attempt to validate totalPercentWatched against the attention span information for the event. If it is missing, HubSpot will calculate this from the attention span map as follows: (number of spans with a value of 1 or more)/(Total number of spans).

externalPlayContext
enum<string>
利用可能なオプション:
EMAIL,
EXTERNAL_PAGE
mediaUrl
string
pageId
integer<int64>

The ID of the page, if hosted on HubSpot. Required for HubSpot pages.

pageName
string

The name of the page. Required if the page is not hosted on HubSpot.

pageObjectCoordinates
string
pageUrl
string

The URL of the page that an event happened on. Required if the page is not hosted on HubSpot.

rawData
string

This is the raw data which provides the most granular data about spans of the media, and how many times each span was consumed by the user. For example, for a 10 second video where each second is a span, if a visitor watches the first 5 seconds of the video, then restarts the video and watches the first 2 seconds again, the resulting rawDataString would be “0=2;1=2;2=1;3=1;4=1;5=0;6=0;7=0;8=0;9=0;”.

totalSecondsPlayed
integer<int32>

The seconds that a user spent consuming the media. The media bridge calculates this as totalPercentPlayed*mediaDuration. If a provider would like this to be calculated differently, they can provide the pre-calculated value when they create the event.

最終更新日 2026年6月11日