Search...
onPostLiked( )
An event that is triggered when a post is liked.
Description
The onPostLiked()
event handler runs when a post is liked. The received PostLikedEvent
object contains data about the liked post including the postId
, and the memberId
or anonymousVisitorId
.
Note: Backend events don't work when previewing your site.
Syntax
function wixBlog_onPostLiked(event: PostLikedEvent): void
onPostLiked Parameters
NAME
TYPE
DESCRIPTION
event
Optional
PostLikedEvent
Information about the post that was liked.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event that occurs when a blog post is liked
Copy Code
1export function wixBlog_onPostLiked(event) {2 const postIdLiked = event.metadata.entityId;3 const memberId = event.data.memberId;4 console.log('Post liked', event);5}678/* Full event object:9 * {10 * "metadata":{11 * "id": "e7ae2019-7d68-4342-8fa0-b28e20e8ec80",12 * "entityId": "e65bd5d9-36ca-4388-8064-3d785d0f5460",13 * "eventTime":"2022-06-16T15:22:49.242Z",14 * "triggeredByAnonymizeRequest":false15 * },16 * "data":{17 * "postId":"e65bd5d9-36ca-4388-8064-3d785d0f5460",18 * "memberId": "33d02592-dd28-4eff-9b8e-4c3bb9c737dd"19 * }20 * }21 */