I have one Shopify store , here i am trying to track the outbound links from my site .
even i have found some code .
<script>
$(document).ready(function(){
var localserver = "trendsnaps.com";
$("a").not("a[href^='http://"+localserver+"']").not("a[href^='https://"+localserver+"']").click(function(){
$(this).attr("target", "blank");
ga('send', 'event', 'links', 'click', $(this).attr('href'));
});
});
</script>
But This code is tracking only "href" links . i wanted to store submit button out going links .
My submit Button code is
<input class="btn add-to-cart-btn" onclick="window.open('{{ product.metafields.google.custom_label_0 }}');" type="submit" value="More Info At {{ product.vendor }}"/>
"product.metafields.google.custom_label_0" is a external static link.
How can i track this links using that same way .