Skip to content

Instantly share code, notes, and snippets.

@ngengs
ngengs / h5ai_item_click_count.js
Created June 28, 2016 17:45
h5ai external script to detect item click, and push to google analytic
if(window.jQuery){
//run when window ready
$(window).ready(function(){
//detect item click
$('body').on('click','.item.file>a',function(e){
var f=$(this);
// Test the function, print the download/clicked file to console
console.log("Downloading:"+f.context.href);
ga('send', 'event', 'File Sharing', 'Download', f.context.href);
})