They say content is key. Well, that's true, and knowing when users are highlighting your content can be extremely insightful.

Not only does this provide the opportunity to know what content is getting gaining more traction, but alternatively, this also helps inform you when visitors could be using your content on their pages.

Using the code below, you can create a tag whenever the highlight event takes place.

document.addEventListener("selectionchange", event => {  

var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
}

let collectedText = text;

if(collectedText !== ""){

window._mfq = window._mfq || [];
window._mfq.push(["tag","Highlight"])

}



})

With this implemented, you'll be able to filter your recorded data for highlight events.

Did this answer your question?