Hello Community - We have a requirement to add some additional tags (highlighted below) as part of href link. Currently we have an plugin/option in Rich Text Editor to specify the target/href url and target (self/blank). We don't need to show the highlighted attributes/options in the plugin UI for authors and should generated once the link is authored. I see some articles that specify some changes related to "link-options.js". Not sure if this is correct. These additional data is required for analytics. Can someone provide some details on how to implement this?
<a title="Privacy Policy" href="https://www.adobe.com"
data-asset-id="container-727741347-link-0"
data-asset-type="LINK"
data-asset-name="Privacy Policy"
target="_blank">
Privacy Policy</a>
Solved! Go to Solution.
Views
Replies
Total Likes
If you have good knowledge on JS then you can customize this "link-options.js", I have done similar implementation in classic UI, but not in Touch UI. you need to put some additional effort for R&D
Another approach is you can write a sling model, that reads the content of the rich text editor, and inside the sling model use regex to find out anchor links and replace anchor links by adding custom attributes.
My preferable approach is, you are adding custom attributes for analytics tracking, I feel, on click on the anchor link you can call below function, link name you can read from the anchor link title. Link type and id either you can hardcode or you can write some logic.
function trackLink(link) {
if (typeof _satellite !== "undefined" && typeof digitalData !== "undefined" ) {
digitalData.page.link.name = "Privacy Policy";
digitalData.page.link.type = "LINK";
digitalData.page.link.id = "your custom id specific logic";
_satellite.track('anchorLink');
}
}
Views
Replies
Total Likes
Please check if this help
The other option would be sling rewriter
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/CustomLinkChecker.java
If you have good knowledge on JS then you can customize this "link-options.js", I have done similar implementation in classic UI, but not in Touch UI. you need to put some additional effort for R&D
Another approach is you can write a sling model, that reads the content of the rich text editor, and inside the sling model use regex to find out anchor links and replace anchor links by adding custom attributes.
My preferable approach is, you are adding custom attributes for analytics tracking, I feel, on click on the anchor link you can call below function, link name you can read from the anchor link title. Link type and id either you can hardcode or you can write some logic.
function trackLink(link) {
if (typeof _satellite !== "undefined" && typeof digitalData !== "undefined" ) {
digitalData.page.link.name = "Privacy Policy";
digitalData.page.link.type = "LINK";
digitalData.page.link.id = "your custom id specific logic";
_satellite.track('anchorLink');
}
}
I think may be a better approach is to handle it with FE of that is possible.
Views
Likes
Replies