curl --request POST \
--url https://api.hubapi.com/media-bridge/v1/events/attention-span \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mediaType": "AUDIO",
"occurredTimestamp": 123,
"rawDataMap": {},
"sessionId": "<string>",
"_hsenc": "<string>",
"contactId": 123,
"contactUtk": "<string>",
"externalId": "<string>",
"externalPlayContext": "EMAIL",
"mediaBridgeId": 123,
"mediaName": "<string>",
"mediaUrl": "<string>",
"pageId": 123,
"pageName": "<string>",
"pageUrl": "<string>",
"rawDataString": "<string>"
}
'{
"contactId": 123,
"mediaBridgeId": 123,
"mediaBridgeObjectCoordinates": "<string>",
"mediaBridgeObjectTypeId": "<string>",
"mediaName": "<string>",
"mediaType": "AUDIO",
"occurredTimestamp": 123,
"percentRange": "<string>",
"portalId": 123,
"providerId": 123,
"sessionId": "<string>",
"totalPercentPlayed": 123,
"externalPlayContext": "EMAIL",
"mediaUrl": "<string>",
"pageId": 123,
"pageName": "<string>",
"pageObjectCoordinates": "<string>",
"pageUrl": "<string>",
"rawData": "<string>",
"totalSecondsPlayed": 123
}curl --request POST \
--url https://api.hubapi.com/media-bridge/v1/events/attention-span \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mediaType": "AUDIO",
"occurredTimestamp": 123,
"rawDataMap": {},
"sessionId": "<string>",
"_hsenc": "<string>",
"contactId": 123,
"contactUtk": "<string>",
"externalId": "<string>",
"externalPlayContext": "EMAIL",
"mediaBridgeId": 123,
"mediaName": "<string>",
"mediaUrl": "<string>",
"pageId": 123,
"pageName": "<string>",
"pageUrl": "<string>",
"rawDataString": "<string>"
}
'{
"contactId": 123,
"mediaBridgeId": 123,
"mediaBridgeObjectCoordinates": "<string>",
"mediaBridgeObjectTypeId": "<string>",
"mediaName": "<string>",
"mediaType": "AUDIO",
"occurredTimestamp": 123,
"percentRange": "<string>",
"portalId": 123,
"providerId": 123,
"sessionId": "<string>",
"totalPercentPlayed": 123,
"externalPlayContext": "EMAIL",
"mediaUrl": "<string>",
"pageId": 123,
"pageName": "<string>",
"pageObjectCoordinates": "<string>",
"pageUrl": "<string>",
"rawData": "<string>",
"totalSecondsPlayed": 123
}Supported products
Required Scopes
The access token received from the authorization server in the OAuth 2.0 flow.
AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO Show child attributes
Show child attributes
EMAIL, EXTERNAL_PAGE successful operation
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.
AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO The timestamp at which this event occurred, in milliseconds since the epoch.
The ID of the HubSpot account.
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).
EMAIL, EXTERNAL_PAGE The ID of the page, if hosted on HubSpot. Required for HubSpot pages.
The name of the page. Required if the page is not hosted on HubSpot.
The URL of the page that an event happened on. Required if the page is not hosted on HubSpot.
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;”.
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.
Was this page helpful?