Hi @anasustic Use can use the below javascript section for adding the cookie.
$(function() {
$(document).on( "click", "a" function() {
var currentElement = $(this);
var url = $(this).attr("href");
if(!link_is_internal(url)) {
document.cookie = 'cookie-value'; // setting a new value
}
});
function link_is_internal(url) {
return (url.indexOf(window.location.host) !== -1 || url.startsWith("/"));
}
});
link_is_internal method over here is handing both the absolute url and the internal link over here, before returning the result.
Hope this helps!
Thanks