An event that is triggered when a tag is created.
The onTagCreated()
event handler runs when a tag is created. The received TagCreated
object contains information about the tag that was created.
Note: Backend events don't work when previewing your site.
function wixBlog_onTagCreated(event: TagCreated): void;
Information about the tag that was created.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onTagCreated(event) {
const tagId = event.metadata.entityId;
const tagUrl = event.entity.url;
console.log("Tag created", event);
}
/*
* {
* "metadata":{
* "id":"f48ae946-a320-4805-985a-28384e9487f3",
* "entityId":"2d85ff8e-885e-47ad-a73a-ce9631c73a77",
* "eventTime":"2022-06-16T15:16:20.376Z"
* },
* "entity":{
* "_createdDate":"2022-06-16T15:16:20.347Z",
* "_id":"2d85ff8e-885e-47ad-a73a-ce9631c73a77",
* "_updatedDate":"2022-06-16T15:16:20.347Z",
* "label":"new label",
* "language":"en"
* "postCount":0,
* "publishedPostCount":0,
* "slug":"new-update",
* "url":"http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/tags/new-label"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.