Skip to content

Commit

Permalink
va-language-toggle: Add label text to event, remove va-link analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ataker committed Dec 11, 2024
1 parent a5cc080 commit 34ce395
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,22 @@ export class VaLanguageToggle {
}

// This method is fired whenever a link is clicked
handleToggle(e: Event, langCode: string): void {
handleToggle(e: Event, langCode: string, linkText: string): void {
// don't navigate from current page but set new language
if (this.routerLinks) {
e.preventDefault();
// change browser url so that :visited styles apply to links
window.history.replaceState(null, null, this.getUrl(langCode));
this.language = langCode;
}

this.vaLanguageToggle.emit({ language: langCode });

const detail = {
componentName: 'va-language-toggle',
action: 'linkClick',
details: {
'pipe-delimited-list-header': langCode
'pipe-delimited-list-header': langCode,
label: linkText,
},
};
this.componentLibraryAnalytics.emit(detail);
Expand Down Expand Up @@ -137,8 +137,9 @@ export class VaLanguageToggle {
class={anchorClass}
href={href}
language={lang}
onClick={(e) => this.handleToggle(e, lang)}
onClick={(e) => this.handleToggle(e, lang, label)}
text={label}
disableAnalytics={true}
/>
</div>
)
Expand Down

0 comments on commit 34ce395

Please sign in to comment.