Track Outbound Links On Your Website

Published on
Featured Image I've been trying to track where exactly people go when they leave my website for a few pages recently, and wrote some code based on a few other examples on the Internet. Basically this bit of Javascript will force Google Analytics to log a special request so that you can see where the user went. It uses jQuery, so you have to make sure you have that included in your theme. Here's some code that will let you track outbound links on your WordPress website. jQuery( 'a' ).on( 'click',function( e ) { var url = jQuery( this ).attr( 'href' ); var customName = jQuery( this ).attr( 'data-link-name' ...