(#5275) Add Tracking to WYSIWYG Link Clicks on Blog Posts#5281
(#5275) Add Tracking to WYSIWYG Link Clicks on Blog Posts#5281dev-rana-publicis wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds NCIDS inner-page analytics tracking for link clicks inside blog post body WYSIWYG content to restore the expected Inner:WYSIWYG:LinkClick event behavior after the blog migration.
Changes:
- Import and initialize
bodyLinkAnalyticsHelperon blog pages. - Add a guarded
cgdpBodyAnalyticsInit()that locates the NCIDS full HTML WYSIWYG container and wires click listeners on DOMContentLoaded.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Verify both elements exist before running helper | ||
| if (blogsBodySection && blogsBodyParent) { | ||
| // NOTE: There should only ever be one instance of the | ||
| // body section on the page, so we can hardcode the section index to 0 | ||
| bodyLinkAnalyticsHelper(blogsBodyParent as HTMLElement, 0); | ||
| blogsBodyAnalyticsInit = true; |
There was a problem hiding this comment.
If this is resolved ^ this PR is good with me
| @@ -16,6 +39,7 @@ const onDOMContentLoaded = () => { | |||
| cgdpEmbedVideoInit(); | |||
| cgdpEmbedCardInit(); | |||
| cgdpDefinitionInit(); | |||
| cgdpBodyAnalyticsInit(); | |||
| }; | |||
There was a problem hiding this comment.
I verified blog post pages load the NCIDS blog entrypoint analytics, and the legacy cgov_common blog-body handler referenced in the review is not the runtime path for these pages. Because of that, this comment is not applicable to the scope of this PR and we won’t fix this.
ODE DeploymentCode has been deployed to ODE 1146. |
|
Blog body links are now firing the correct Inner:WYSIWYG:LinkClick event! |
2919a1a to
7fc23df
Compare
davisaw
left a comment
There was a problem hiding this comment.
Looks good! External feature cards now firing just one analytics event. Body links, glossified links, and other embedded content still firing correctly.
Also, it's okay that link text is not truncated to 50 characters. Adobe truncates to a character limit in our reporting
7fc23df to
9cfe4a2
Compare
9cfe4a2 to
c38a996
Compare
Closes #5275