Change Click Type for a Given CTA with Click Label

Hey @Will_Walker, that’s correct, you’re adding these to the component.js file for the card.

And you are also correct, as outlined, the CTA Label is a static value, so would be the same for each FAQ clicked. However, you could make the value a variable instead and use any attribute of the entity’s profile, like this:

dataForRender(profile) {
    
    var ctaLabelValue = "My custom label - " + profile.id;
    return {
      title: profile.name, // The header text of the card
      url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here
      target: '_top', // If the title's URL should open in a new tab, etc.

      // other fields here      

      // The primary CTA of the card
      CTA1: {
       label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label
       iconName: 'chevron', // The icon to use for the CTA
       url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
       target: '_top', // Where the new URL will be opened
       eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
       eventOptions: this.addDefaultEventOptions({ ctaLabel : ctaLabelValue })
      },
      // other CTA here
    };
  }

For the first FAQ you referenced, the label will be My custom label - 18720171. You can use any field on the entity in this variable (IE say you wanted the label to be the name of the entity, you’d set var ctaLabelValue = profile.name). With this strategy, keep in mind that the entity data in the knowledge graph can change. This will cause inconsistencies in your analytics; we’d therefore recommend picking values you expect to remain consistent, like the entity ID (this will depend on how your knowledge graph is configured).

Let us know if you have any other questions!

Thanks,
Rose