How to check if url is a redirect hit or not using shopify scripttag API? using Javascript/Jquery

As you know we can create redirect inside Shopify. I want to track using shopify script tag api if url is redirect hit or not( or number of times redirect is hit).

For example:- Path:- www.example-domain.com/cloth Target:- www.example-domain.com/cloth2

Currently shopify is redirecting this from its end.

I want to track, how many times this path was hit on browser?. Is there any way to do that?.

Below is the example/test code I have tried but it does not work at all

<script>
 function UrlExists(url, cb) {
    jQuery.ajax({
        url: url,
        dataType: 'text',
        type: 'GET',
        complete: function (`enter code here`xhr) {
            if (typeof cb === 'function')
                cb.apply(this, [xhr.status]);
        }
    });
}

UrlExists('-- Insert Url Here --', function (status) {
    if (status === 200) {
        // Execute code if successful
    } else if (status === 301) {
        // Execute code if not successful
       alert("redirect-hit");
    } else {
        // Execute code if status doesn't match above
      alert("abc");
    }
});
</script>