Last active
April 26, 2024 05:14
-
-
Save fitsum/5978638 to your computer and use it in GitHub Desktop.
Push URLs with .ppt | .doc | .pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('a').on('click',function(){ | |
var $href = $(this).attr('href'); | |
var $pptDoc = new RegExp(".ppt$").test($href); | |
var $wordDoc = new RegExp(".doc$").test($href); | |
var $pdfDoc = new RegExp(".pdf$").test($href); | |
var $docType; | |
function push2GA(thisURL,thisOptValue){ | |
_gaq.push(['_trackEvent', 'Download', thisURL, thisOptValue]); | |
} | |
if($pptDoc){$docType = "PowerPoint"; push2GA($href,$docType)} | |
else if($wordDoc){$docType = "Word Document"; push2GA($href,$docType)} | |
else if($pdfDoc){$docType = "Adobe Acrobat PDF"; push2GA($href,$docType)} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment