埋GA

分享至
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());

 gtag('config', 'UA-145700324-1');
</script>

<a href="#" class="btn-join pull-center" data-toggle="modal" data-target="#butnInfo" onclick="GAEvent('公會長-報名公會長點擊');"></a>


function GAEvent(label, category, action){ 
 if(category==undefined){
  category='Button';
 }
 if(action==undefined){
  action='Action';
 } 
 // console.log('label:', label, ' category:', category, ' action:', action);
 gtag('event', action, {
   'event_category' : category,
   'event_label' : label
    });
}

發表迴響