You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our analytics events optionally accept a ctaLabel attribute. Right now, the only way for an admin to configure this is by entirely overwriting eventOptions, but to do so, they need to add in a lot of logic (whether it's on vertical / universal, the entity Id, etc).
We should expose this label attribute as a top level config option so it's easier to use it.
Defaults to null
Should accept either a string, or a function that takes in the result data.
If present, should be passed as ctaLabel attribute as a part of eventOptions, like this:
Here's what callsToAction would look like:
const callsToAction = [{
// Label below the CTA icon, default null
label: 'cta label',
// Icon name for the CTA that is one of the built-in icons, defaults to undefined (no icon). If your icon
// is not recognized it will default to 'star'.
icon: 'star',
// URL to a custom icon for the cta. This takes priority over icon if both are present, default is
// no icon url.
iconUrl: 'https://urltomyicon.com/customicon.gif',
// Click through url for the icon and label
// Note, a protocol like https:// is required here.
url: 'https://yext.com',
// Analytics event that should fire, defaults to 'CTA_CLICK':
// 'TITLE_CLICK',
// 'CTA_CLICK',
// 'TAP_TO_CALL',
// 'ORDER_NOW',
// 'ADD_TO_CART',
// 'APPLY_NOW',
// 'DRIVING_DIRECTIONS',
// 'VIEW_WEBSITE',
// 'EMAIL',
// 'BOOK_APPOINTMENT',
// 'RSVP'
analytics: 'CTA_CLICK',
//NEW, passed as a ctaLabel for the event.
analyticsLabel: 'My CTA Label',
// The target attribute for the CTA link, defaults to '_blank'. To open in a new window use '_blank'
target: '_blank',
// The eventOptions needed for the event to fire. Either a valid json string, an object, or a function that
// takes in the result data response.
// By default, if no event options are specified the SDK will try to add verticalKey, entityId, and searcher options
// to the analytics event.
eventOptions: result => {
return {
// The vertical key for the CTA. If unspecified, this defaults to the vertical key this cta is a part of
verticalKey: "people",
// The entity id of the result this cta is a part of, defaults to the entityId field in Knowledge Graph
entityId: result.id,
// If the CTA is inside a vertical search, defaults to the value "VERTICAL",
// if is inside a universal search, defaults to the value "UNIVERSAL"
searcher: "VERTICAL",
//ADDED - passed as a ctaLabel for the event.
ctaLabel: "My label",
};
}
}]
The text was updated successfully, but these errors were encountered:
Our analytics events optionally accept a
ctaLabel
attribute. Right now, the only way for an admin to configure this is by entirely overwriting eventOptions, but to do so, they need to add in a lot of logic (whether it's on vertical / universal, the entity Id, etc).We should expose this label attribute as a top level config option so it's easier to use it.
ctaLabel
attribute as a part of eventOptions, like this:Here's what callsToAction would look like:
The text was updated successfully, but these errors were encountered: