Data
When you subscribe to caast.on
method (details here) you will receive data in order to apply some custom logic on your side
In every emitted events the following data is made available for you to interact with your environment. We choose to expose a common data presented below. You will also have custom data related to the listening event. You will find more informations about witch event send additionnal data by reading the following.
Common data
{
// Config key will store here all the informations regarding the Website configuration,
// translations, defined colors etc..
"config": { ... },
// User key will store user information, more details below because this object can be extended
"user": {
"uuid": "1d5f65e4d53b20fcb223a7dc0aec3ea0"
},
// UserAccess key will store the current user ban status informations
"userAccess": {
"hardBan": null,
"softBan": null
},
// FromCaastIframe key will return a boolean indicating if current data is retrieved from an iframe or from the main Caast instance
"fromCaastIframe": false
}
user
When using the setUser method, you will add additional informations on the user object in global config, the object will now have a custom_fields
entry in it, regrouping all the data you've provided
"user": {
"uuid": "1d5f65e4d53b20fcb223a7dc0aec3ea0",
"custom_fields": {
"email": "d.copperfield@abracadabra.io",
"first_name": "David",
"last_name": "Copperfield"
}
}
The user entry can also be altered when a user set his nickname or decide to go as anonymous in the ChatRoom, you will then receive an object additional keys
"user": {
"uuid": "1d5f65e4d53b20fcb223a7dc0aec3ea0",
"custom_fields": {
"email": "d.copperfield@abracadabra.io",
"first_name": "David",
"last_name": "Copperfield"
},
"author": "davidCopperfield"
}
// OR
"user": {
"uuid": "1d5f65e4d53b20fcb223a7dc0aec3ea0",
"custom_fields": {
"email": "d.copperfield@abracadabra.io",
"first_name": "David",
"last_name": "Copperfield"
},
"anonymous": true
}
contentId
When listening to an event related to a content, you will receive additional information regarding the current content id.
For legacy purpose you can still retrieve live_id
, but this new variable must be used if possible
"contentId": "f20aa128931a449b9478f5fb69e07c3b"
content
When listening to an event related to a content, you will receive additional information regarding the current content.
For legacy purpose you can still retrieve live
, but this new variable must be used if possible
"content": {
"attributes": {
// If finished, total duration of the content in seconds
"cachedDuration": 1803,
// Indicate if chat is enabled on this content
"chatEnabled": true,
"chatTabEnabled": false,
// Description of the content
"description":"My content description",
// Orientation of the video for this content
"displayMode":"landscape",
// Media url for portrait thumbnail
"displayPortraitThumbnailUrl":null,
// Media url for landscape thumbnail
"displayThumbnailUrl":"https://mediadev.caast.tv/...",
// End date for the content, can be null if live not yet finished
"endDate":"2023-02-14T11:00:52.000Z",
// Indicate if a live is finished
"isFinished":true,
// Indicate if likes are enabled
"likesEnabled":true,
// Indicate if likes are enabled
"liveIsReady":true,
// Name of the content
"name":"My content name",
// Indicate if premoderation is active
"premoderation":false,
// Indicate if automatic premoderation is active, which means it will be automatically disabled when live starts
"premoderationAutomatic":false,
// Indicate if the content must start at a specific timecode, this value can be override by product/url specific configuration
"startAtTimecode":0,
// Start date fior the content
"startDate":"2023-02-13T16:20:00.000Z",
// Indicate if a content has a teaser
"teaserVideoId":"UOTNfdpF3hVye4RszSncjI9V00ao02Br3bsICHS01SXegM",
// Indicate the total number of presented products
"totalProducts":0,
// Indicate the total number of questions
"totalQuestions":0,
// Indicate content type, can be "Live" or "Video"
"type":"Live",
// Video ID for the replay
"videoId":"ryeTnqlUCkC00U6D1E5p9i7xbYTaG8LcEMUOit8K02gnk",
},
"id": "f20aa128931a449b9478f5fb69e07c3b"
}
products
When listening to an event using onProductLoaded method, you will receive additional informations regarding the presented products.
"products": [{
"id": "86f2e89f7373402cadca39278652a589",
"type": "productLive",
"attributes": {
"additionalCartData":{},
"additionalPicturesUrl":[],
"complementaryInformationsFiltered": {},
"name":"",
"description": "",
"discountPriceLabel": "",
"inStock": "",
"parentProviderRef": false,
"pricing": {
"discountPrice": "",
"price":"",
},
"ref": "",
"thumbnailUrl": "",
"url": ""
}
}]
productTimestamps
When listening to an event using onProductLoaded method, you will receive additional informations regarding the presented products timestamps. This data can be useful if you want to analyze what segment of your content is being watched and what products are being presented.
"productTimestamps": [{
"id": "",
"type": "productTimestamp",
"attributes": {
"productId": "86f2e89f7373402cadca39278652a589",
"secondsEnd":0,
"secondsStart": 30,
"timestampEnd":"",
"timestampStart": "",
}
}]
player
When listening to an event using onLivePlay, onLivePause or onCollectionContentChange method, you will receive additional informations regarding the player state.
"player": {
"seconds": 36.8,
"duration": 196
}
When watching a live event, you will receive duration: Infinity
, the seconds
value will be an approximate current time.
You may encounter duration: NaN
value on some onLivePlay
events, this is caused by the play event triggered before all content metadata was loaded. If you want to be sure of the current content duration, listen to the onMetaData
isTeaser
When listening to an event using onLivePlay, onLivePause or onCollectionContentChange method, you will receive additional informations indicating if the played media is a teaser on your content
"isTeaser": false
question_id
When listening to an event using onQuestionClick method, you will receive additional informations regarding the question id.
"question_id": "452159334435456999954edb1a04d779"
product_id
When listening to an event using onProductClick method, you will receive additional informations regarding the product id.
"product_id": "925da3518ec44b29a0cf2ed86a3610e6"
product_ref
When listening to an event using onProductClick method, you will receive additional informations regarding the product ref.
"product_ref": "128627"
product_detailed
When listening to an event using onProductDetailsClick, onProductDetailsShow, onProductOpen or onBasketAdd method, you will receive additional informations regarding the product details. This information regroup all the product available variations and properties, contrary to the currentProductDetails
which contain the current matching variation for the selected product.
"product_detailed": {
...
}
message
When listening to an event using onMessageSubmit method, you will receive additional informations regarding the submitted message.
"message": {
"author": "davidCopperfield",
"message": "Abracadabra !"
}
from_caast
When listening to an event using onProductClick method, you will receive additional informations regarding the context of the action. If this event is coming from our direct add to cart method you will receive this data.
"from_caast": "true"
share
When listening to an event using onShare method, you will receive additional informations regarding the context of the action.
"share": {
"type": "mobile" | "url" | "facebook" | "twitter" | "linkedin" | "messenger" | "whatsapp",
"url": "https://..."
}
The mobile
type is emitted when the user is using the native share option only available on mobile devices. You cannot have further informations on what application the link is going to be shared on after this event is triggered.
emoji
When listening to an event using onReaction method, you will receive additional informations regarding the emoji the user just sent.
"emoji": "❤️"
extensionDetails
When listening to an event using onExtensionDetailsClick, onExtensionDetailsShow, or onExtensionDetailsClose method, you will receive additional informations regarding the extension details. Below is an exemple of what this object looks like.
"extensionDetails": {
"attributes": {
"configuration": {
"title": "Extension card title",
"text": "Extension card text",
"background_color": "#27ccb8",
"text_color": "#d60707"
},
"extensionId": "ea21a60968e74473918f18b854629504",
"extensionNoReload": true,
"extensionUrl": "https://story.tl/demo-asus?transparent=1&mode=mobile",
"thumbnailUrl": null,
"triggerId": "919f9e6d5d1540bda2fb9293b85a8a92",
"triggerName": "pushed_box" | "announcement"
},
"id": "bc5b8bff46f74ee68937485672960f1f",
"type": "extensionTrigger"
}
relatedCurrentContentId
When listening to an event using onRelatedClick method, you will receive additional informations regarding the related current content being watched. Below is an exemple of what this object looks like.
"relatedCurrentId": "f20aa128931a449b9478f5fb69e07c3b"
relatedCurrentContent
When listening to an event using onRelatedClick method, you will receive additional informations regarding the related current content being watched. Below is an exemple of what this object looks like. Refer to content for further details
relatedNextContentId
When listening to an event using onRelatedClick method, you will receive additional informations regarding the next related content being clicked. Below is an exemple of what this object looks like.
"relatedNextId": "49f5fe9b753a43e2807e81e59c66fca3"
collection
When the current integration contain a Shorts Card or Shorts Story page, Caast will emit this data containing details about the current collection configuration.
"collection": {
"id": "",
"attributes": {
"name":"Collection for Fashion universe",
"contents": [{...}, {...}],
"contentsCount":6,
"playlistId":"577589f7bb2d462f96579f96a1536af7"
}
}
collectionItems
When the current integration contain a Shorts Card or Shorts Story page, Caast will emit this data containing details about the current collection contents.
The structure of each content is detailed in the content section.
"collectionItems": [{...}, {...}],
collectionId
When the current integration contain a Shorts Card or Shorts Story page, you will receive additional informations regarding the current collection ID being loaded. Below is an exemple of what this object looks like.
"collectionId": "d7df2370e4114bcc979bf09782ff0cd2"
collectionCurrentContentId
When listening to an event using onCollectionContentChange method, you will receive additional informations regarding the current content being watched. Below is an exemple of what this object looks like.
"collectionCurrentContentId": "f20aa128931a449b9478f5fb69e07c3b"
collectionNextContentId
When listening to an event using onCollectionContentChange method, you will receive additional informations regarding the next content being loaded. Below is an exemple of what this object looks like.
"collectionNextContentId": "49f5fe9b753a43e2807e81e59c66fca3"
rating
When listening to an event using onReviewStarRating method, you will receive additional informations regarding the note a user has attributed to your content. The returned note is between 1 and 5.
"rating": 3
survey
When listening to an event using onSurveyShow, onSurveyVote and onSurveyClose method, you will receive additional informations regarding the survey.
"survey" : {
"attributes": {
"activeBackgroundColor": null,
"activeColorText": null,
"textColor": null,
"cardColor": null,
"createdAt:": "2023-03-13T12:00:00.000Z",
"question": "What is the most beautiful color ?",
"answers": [
{
"attributes": {
"answer": "Red"
},
"id": "471027ec63744cf68fb07ac614fa5bc5",
"type": "surveyAnswer"
},
{
"attributes": {
"answer": "Blue"
},
"id": "0bd0354d898b43e09b40e3da93877a81",
"type": "surveyAnswer"
}
]
},
"id": "c04b03b9495d4baa8b3fa1af5e05ab83",
"type": "survey"
}
surveyAnswer
When listening to an event using onSurveyVote method, you will receive additional informations regarding the survey's answer the user selected.
"surveyAnswer": {
"attributes": {
"answer": "Red"
},
"id": "471027ec63744cf68fb07ac614fa5bc5",
"type": "surveyAnswer"
}
floating
When listening to an event related to a floating, you will receive additional information regarding the current floating configuration
"floating": {
"attributes": {
"content", // see content data exemple
"playlistId":"9a38cfdbc74046abbbc83b01691bc642"
},
"id": "471027ec63744cf68fb07ac614fa5bc5"
}
floatingId
When listening to an event related to a floating, you will receive additional information regarding the current floating ID
"floatingId": "471027ec63744cf68fb07ac614fa5bc5"
integrations
When listening to an event using onIntegrationsLoaded method, you will receive additional information regarding the current integrations
"integrations": [{
"attributes": {
"customStyle": "",
"groups": [{
"attributes": {
"items":[{
"id": "6178a3dfecd0472dbbd8ae717676acdc",
"type": "integrationItemFront",
"attributes": {
"settings": {
"next_auto": true,
"width_of_item": 260,
"gap_between_item": 10,
"hover_behaviour": "preview"
},
"position": 0,
"templateBlockFixedName": "shorts_carousel",
"templateBlockName": "Shorts Carousel",
"thumbnailUrl": null,
"contents": [...],
"playlistId": "577589f7bb2d462f96579f96a1536af7",
"contentsCount": 6
}
}],
"mobileTarget":"",
"mobileTargetPosition":"",
"target":".bg-white",
"targetPosition":"afterbegin",
},
"id": "b89f37f050c944e49d81ecf3115f64c1"
}],
"name": "My first integration"
},
"id": "26281358f29f4bc0a986344dea7ba464"
}]
integrationsIds
When listening to an event using onIntegrationsLoaded method, you will receive additional information regarding the current integrations Ids
"integrationsIds": ["26281358f29f4bc0a986344dea7ba464"]