Please follow the below the example for GA event function used in javascript function.
function call in below example for dynamic Event function .
setGa('Category Name',' level name');
-----------------------------------------------------------
function setGa(catName,value){
var currentPage = jQuery("#page").val();
var blogType = jQuery('#selectType option:selected').val();
var ajaxHitUrl = window.location.protocol + '//' + window.location.hostname + '/';
if(gaMainURL=='blog'){
var gAUrl = ajaxHitUrl+'datacenter/blog?blogType='+blogType+'&shc_page='+shc_page+'&page='+currentPage;
}else{
var gAUrl = ajaxHitUrl+'datacenter/social-hub/podcast?blogType='+blogType+'&shc_page=1&page='+currentPage;
}
ga('send','event',catName,value.toString(),gAUrl.toString());
ga('set', 'page', gAUrl.toString());
ga('send', 'pageview');
}
function call in below example for dynamic Event function .
setGa('Category Name',' level name');
-----------------------------------------------------------
function setGa(catName,value){
var currentPage = jQuery("#page").val();
var blogType = jQuery('#selectType option:selected').val();
var ajaxHitUrl = window.location.protocol + '//' + window.location.hostname + '/';
if(gaMainURL=='blog'){
var gAUrl = ajaxHitUrl+'datacenter/blog?blogType='+blogType+'&shc_page='+shc_page+'&page='+currentPage;
}else{
var gAUrl = ajaxHitUrl+'datacenter/social-hub/podcast?blogType='+blogType+'&shc_page=1&page='+currentPage;
}
ga('send','event',catName,value.toString(),gAUrl.toString());
ga('set', 'page', gAUrl.toString());
ga('send', 'pageview');
}