var url = document.location; var device = 'PC'; device = checkmobile(); if (device === 'Mobile') { url = window.location.protocol + '//' + window.location.host + '/mobile' + window.location.pathname; } jQuery.getJSON('//marykay.events.pixnet.net/addhits.php?url='+url);